--- jsr166/src/test/tck/PhaserTest.java 2014/12/31 19:05:43 1.39 +++ jsr166/src/test/tck/PhaserTest.java 2015/10/05 22:38:38 1.43 @@ -20,7 +20,7 @@ import junit.framework.TestSuite; public class PhaserTest extends JSR166TestCase { public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); + main(suite(), args); } public static Test suite() { @@ -338,8 +338,8 @@ public class PhaserTest extends JSR166Te * registered or unarrived parties would become negative */ public void testArriveAndDeregister1() { + Phaser phaser = new Phaser(); try { - Phaser phaser = new Phaser(); phaser.arriveAndDeregister(); shouldThrow(); } catch (IllegalStateException success) {} @@ -625,11 +625,11 @@ public class PhaserTest extends JSR166Te threads.add(newStartedThread(new CheckedRunnable() { public void realRun() { for (int k = 0; k < 3; k++) { - assertEquals(2*k+1, phaser.arriveAndAwaitAdvance()); + assertEquals(2 * k + 1, phaser.arriveAndAwaitAdvance()); count.incrementAndGet(); - assertEquals(2*k+1, phaser.arrive()); - assertEquals(2*k+2, phaser.awaitAdvance(2*k+1)); - assertEquals(4*(k+1), count.get()); + assertEquals(2 * k + 1, phaser.arrive()); + assertEquals(2 * k + 2, phaser.awaitAdvance(2 * k + 1)); + assertEquals(4 * (k + 1), count.get()); }}})); for (Thread thread : threads) @@ -685,7 +685,7 @@ public class PhaserTest extends JSR166Te for (Phaser phaser : phasers) { assertEquals(-42, phaser.awaitAdvance(-42)); assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42)); - assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42, SMALL_DELAY_MS, MILLISECONDS)); + assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42, MEDIUM_DELAY_MS, MILLISECONDS)); } for (Phaser child : onePartyChildren) @@ -693,10 +693,10 @@ public class PhaserTest extends JSR166Te for (Phaser phaser : phasers) { assertEquals(-42, phaser.awaitAdvance(-42)); assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42)); - assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42, SMALL_DELAY_MS, MILLISECONDS)); + assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42, MEDIUM_DELAY_MS, MILLISECONDS)); assertEquals(1, phaser.awaitAdvance(0)); assertEquals(1, phaser.awaitAdvanceInterruptibly(0)); - assertEquals(1, phaser.awaitAdvanceInterruptibly(0, SMALL_DELAY_MS, MILLISECONDS)); + assertEquals(1, phaser.awaitAdvanceInterruptibly(0, MEDIUM_DELAY_MS, MILLISECONDS)); } for (Phaser child : onePartyChildren) @@ -704,13 +704,13 @@ public class PhaserTest extends JSR166Te for (Phaser phaser : phasers) { assertEquals(-42, phaser.awaitAdvance(-42)); assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42)); - assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42, SMALL_DELAY_MS, MILLISECONDS)); + assertEquals(-42, phaser.awaitAdvanceInterruptibly(-42, MEDIUM_DELAY_MS, MILLISECONDS)); assertEquals(2, phaser.awaitAdvance(0)); assertEquals(2, phaser.awaitAdvanceInterruptibly(0)); - assertEquals(2, phaser.awaitAdvanceInterruptibly(0, SMALL_DELAY_MS, MILLISECONDS)); + assertEquals(2, phaser.awaitAdvanceInterruptibly(0, MEDIUM_DELAY_MS, MILLISECONDS)); assertEquals(2, phaser.awaitAdvance(1)); assertEquals(2, phaser.awaitAdvanceInterruptibly(1)); - assertEquals(2, phaser.awaitAdvanceInterruptibly(1, SMALL_DELAY_MS, MILLISECONDS)); + assertEquals(2, phaser.awaitAdvanceInterruptibly(1, MEDIUM_DELAY_MS, MILLISECONDS)); } } @@ -748,8 +748,8 @@ public class PhaserTest extends JSR166Te * unarrived parties */ public void testArriveAndAwaitAdvance1() { + Phaser phaser = new Phaser(); try { - Phaser phaser = new Phaser(); phaser.arriveAndAwaitAdvance(); shouldThrow(); } catch (IllegalStateException success) {}