ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ScheduledExecutorTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ScheduledExecutorTest.java (file contents):
Revision 1.74 by jsr166, Tue Oct 6 16:39:06 2015 UTC vs.
Revision 1.76 by jsr166, Thu Oct 8 03:08:37 2015 UTC

# Line 1046 | Line 1046 | public class ScheduledExecutorTest exten
1046      public void testTimedInvokeAny4() throws Exception {
1047          final ExecutorService e = new ScheduledThreadPoolExecutor(2);
1048          try (PoolCleaner cleaner = cleaner(e)) {
1049 +            long startTime = System.nanoTime();
1050              List<Callable<String>> l = new ArrayList<Callable<String>>();
1051              l.add(new NPETask());
1052              try {
1053 <                e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
1053 >                e.invokeAny(l, LONG_DELAY_MS, MILLISECONDS);
1054                  shouldThrow();
1055              } catch (ExecutionException success) {
1056                  assertTrue(success.getCause() instanceof NullPointerException);
1057              }
1058 +            assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
1059          }
1060      }
1061  
# Line 1063 | Line 1065 | public class ScheduledExecutorTest exten
1065      public void testTimedInvokeAny5() throws Exception {
1066          final ExecutorService e = new ScheduledThreadPoolExecutor(2);
1067          try (PoolCleaner cleaner = cleaner(e)) {
1068 +            long startTime = System.nanoTime();
1069              List<Callable<String>> l = new ArrayList<Callable<String>>();
1070              l.add(new StringTask());
1071              l.add(new StringTask());
1072 <            String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
1072 >            String result = e.invokeAny(l, LONG_DELAY_MS, MILLISECONDS);
1073              assertSame(TEST_STRING, result);
1074 +            assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
1075          }
1076      }
1077  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines