Permalink
Browse files

synchronizer attempts to trigger different threads within timeout

  • Loading branch information...
1 parent 623bd92 commit 44b426792863f5fdc8cbedfc201a0a8ba0fe83dd @Tibor17 committed Sep 23, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/test/java/org/junit/tests/experimental/parallel/ParallelClassTest.java
View
10 src/test/java/org/junit/tests/experimental/parallel/ParallelClassTest.java
@@ -11,9 +11,11 @@
import org.junit.runner.Result;
import org.junit.Before;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
public class ParallelClassTest {
+ private static final long TIMEOUT= 15;
private static volatile Thread fExample1One= null;
private static volatile Thread fExample1Two= null;
private static volatile Thread fExample2One= null;
@@ -23,24 +25,24 @@
public static class Example1 {
@Test public void one() throws InterruptedException {
fSynchronizer.countDown();
- fSynchronizer.await();
+ assertTrue(fSynchronizer.await(TIMEOUT, TimeUnit.SECONDS));
fExample1One= Thread.currentThread();
}
@Test public void two() throws InterruptedException {
fSynchronizer.countDown();
- fSynchronizer.await();
+ assertTrue(fSynchronizer.await(TIMEOUT, TimeUnit.SECONDS));
fExample1Two= Thread.currentThread();
}
}
public static class Example2 {
@Test public void one() throws InterruptedException {
fSynchronizer.countDown();
- fSynchronizer.await();
+ assertTrue(fSynchronizer.await(TIMEOUT, TimeUnit.SECONDS));
fExample2One= Thread.currentThread();
}
@Test public void two() throws InterruptedException {
fSynchronizer.countDown();
- fSynchronizer.await();
+ assertTrue(fSynchronizer.await(TIMEOUT, TimeUnit.SECONDS));
fExample2Two= Thread.currentThread();
}
}

0 comments on commit 44b4267

Please sign in to comment.