From c3c0ab7947fb04fca7aff72913dbc81738ca5af0 Mon Sep 17 00:00:00 2001 From: youtaol Date: Thu, 3 May 2012 11:27:19 +0800 Subject: [PATCH] Add a comment about a assertion. --- .../AdaptiveLocationListenerPolicyTest.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/services/AdaptiveLocationListenerPolicyTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/services/AdaptiveLocationListenerPolicyTest.java index 712f3597b..22741cad5 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/services/AdaptiveLocationListenerPolicyTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/services/AdaptiveLocationListenerPolicyTest.java @@ -41,30 +41,32 @@ public class AdaptiveLocationListenerPolicyTest extends TestCase { /** * Tests the - * {@link AdaptiveLocationListenerPolicy#getDesiredPollingInterval()} in four situations. + * {@link AdaptiveLocationListenerPolicy#getDesiredPollingInterval()} in four + * situations. * + * */ public void testGetDesiredPollingInterval() { adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_BIG); assertEquals(MAX, adocationListenerPolicy.getDesiredPollingInterval()); adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_NORMAL); - assertEquals((NEW_IDLE_TIME_NORMAL / 2000) - * 1000, + // First get the half of NEW_IDLE_TIME_NORMAL, and then round it to the + // nearest second. + assertEquals((NEW_IDLE_TIME_NORMAL / 2 / 1000) * 1000, adocationListenerPolicy.getDesiredPollingInterval()); - + adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_SMALL); assertEquals(MIN, adocationListenerPolicy.getDesiredPollingInterval()); adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_LESS_THAN_MIN); assertEquals(MIN, adocationListenerPolicy.getDesiredPollingInterval()); } - + /** * Tests the method {@link AdaptiveLocationListenerPolicy#getMinDistance()}. */