Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

synchronizer attempts to trigger different threads within timeout

  • Loading branch information...
commit 44b426792863f5fdc8cbedfc201a0a8ba0fe83dd 1 parent 623bd92
@Tibor17 authored
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();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.