changeset 2054:d06e1068ee9f

Fix time sensitive test testCheckIsCursorExpired() in CursorManagerTest PR3310 Reviewed-by: jkang Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-January/022097.html
author Alex Macdonald <almacdon@redhat.com>
date Mon, 30 Jan 2017 16:10:30 -0500
parents b26b8fbf819d
children a9e0b307de83
files web/server/src/test/java/com/redhat/thermostat/web/server/CursorManagerTest.java
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/web/server/src/test/java/com/redhat/thermostat/web/server/CursorManagerTest.java	Tue Jan 17 13:50:30 2017 -0500
+++ b/web/server/src/test/java/com/redhat/thermostat/web/server/CursorManagerTest.java	Mon Jan 30 16:10:30 2017 -0500
@@ -239,10 +239,9 @@
     
     @Test
     public void testCheckIsCursorExpired() {
-        long now = System.currentTimeMillis();
+        long now = 0;
         CursorHolder holder = new CursorHolder(mock(BatchCursor.class), now);
-        sleep(10);
-        long laterTime = System.currentTimeMillis();
+        long laterTime = 10;
         assertFalse("cursor still valid. timeout == 20ms, but only 10ms old.",
                 holder.checkIsCursorExpired(laterTime, 20));
         assertTrue("cursor older than 5 milliseconds", holder.checkIsCursorExpired(laterTime, 5));