Add a comment about a assertion.

This commit is contained in:
youtaol
2012-05-03 11:27:19 +08:00
parent 94c11face5
commit c3c0ab7947
@@ -41,30 +41,32 @@ public class AdaptiveLocationListenerPolicyTest extends TestCase {
/** /**
* Tests the * Tests the
* {@link AdaptiveLocationListenerPolicy#getDesiredPollingInterval()} in four situations. * {@link AdaptiveLocationListenerPolicy#getDesiredPollingInterval()} in four
* situations.
* <ul> * <ul>
* <li>The newIdleTime is bigger than max interval.</li> * <li>The newIdleTime is bigger than max interval.</li>
* <li>The newIdleTime is between min and max interval.</li> * <li>The newIdleTime is between min and max interval.</li>
* <li>The newIdleTime is smaller than max interval.</li> * <li>The newIdleTime is smaller than max interval.</li>
* <li>The newIdleTime is smaller than the smallest interval unit.</li> * <li>The newIdleTime is smaller than the smallest interval unit.</li>
* </ul> * </ul>
*/ */
public void testGetDesiredPollingInterval() { public void testGetDesiredPollingInterval() {
adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_BIG); adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_BIG);
assertEquals(MAX, adocationListenerPolicy.getDesiredPollingInterval()); assertEquals(MAX, adocationListenerPolicy.getDesiredPollingInterval());
adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_NORMAL); adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_NORMAL);
assertEquals((NEW_IDLE_TIME_NORMAL / 2000) // First get the half of NEW_IDLE_TIME_NORMAL, and then round it to the
* 1000, // nearest second.
assertEquals((NEW_IDLE_TIME_NORMAL / 2 / 1000) * 1000,
adocationListenerPolicy.getDesiredPollingInterval()); adocationListenerPolicy.getDesiredPollingInterval());
adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_SMALL); adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_SMALL);
assertEquals(MIN, adocationListenerPolicy.getDesiredPollingInterval()); assertEquals(MIN, adocationListenerPolicy.getDesiredPollingInterval());
adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_LESS_THAN_MIN); adocationListenerPolicy.updateIdleTime(NEW_IDLE_TIME_LESS_THAN_MIN);
assertEquals(MIN, adocationListenerPolicy.getDesiredPollingInterval()); assertEquals(MIN, adocationListenerPolicy.getDesiredPollingInterval());
} }
/** /**
* Tests the method {@link AdaptiveLocationListenerPolicy#getMinDistance()}. * Tests the method {@link AdaptiveLocationListenerPolicy#getMinDistance()}.
*/ */