changeset 1918:584e4a182c7e

[1.6] Small test case fix for PR2037 review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-June/019498.html reviewed-by: jerboaa PR3005
author Mario Torre <neugens.limasoftware@gmail.com>
date Wed, 15 Jun 2016 16:14:45 +0200
parents ad2d2e5ad608
children e798de1fb475
files thread/client-controllers/src/test/java/com/redhat/thermostat/thread/client/controller/impl/ThreadCountControllerTest.java
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/thread/client-controllers/src/test/java/com/redhat/thermostat/thread/client/controller/impl/ThreadCountControllerTest.java	Wed Jun 15 12:08:58 2016 +0200
+++ b/thread/client-controllers/src/test/java/com/redhat/thermostat/thread/client/controller/impl/ThreadCountControllerTest.java	Wed Jun 15 16:14:45 2016 +0200
@@ -175,7 +175,7 @@
          url = "http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2037",
          summary = " Thread count view queries all summaries for the last hour, every second")
     @Test
-    public void testPR2037() {
+    public void testPR2037() throws InterruptedException {
         ArgumentCaptor<Range> collectorCaptor = ArgumentCaptor.forClass(Range.class);
         when(collector.getThreadSummary(collectorCaptor.capture())).thenReturn(new ArrayList());
         when(collector.getLatestThreadSummary()).thenReturn(mock(ThreadSummary.class));
@@ -191,6 +191,11 @@
 
         Range<Long> range1 =  collectorCaptor.getValue();
 
+        // Ensure that there is at least a millisecond difference between
+        // the two calls of run, so the Range has a chance to be updated
+        // correctly
+        Thread.sleep(1);
+
         threadAction.run();
         Range<Long> range2 =  collectorCaptor.getValue();