1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
* Other contributors include John Vint |
6 |
|
*/ |
7 |
|
|
8 |
+ |
import junit.framework.*; |
9 |
|
import java.util.ArrayList; |
10 |
|
import java.util.List; |
11 |
< |
import java.util.concurrent.atomic.AtomicInteger; |
12 |
< |
import java.util.concurrent.atomic.AtomicBoolean; |
12 |
< |
import java.util.concurrent.*; |
11 |
> |
import java.util.concurrent.Phaser; |
12 |
> |
import java.util.concurrent.CountDownLatch; |
13 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
14 |
|
import static java.util.concurrent.TimeUnit.NANOSECONDS; |
15 |
< |
import junit.framework.Test; |
16 |
< |
import junit.framework.TestSuite; |
15 |
> |
import java.util.concurrent.atomic.AtomicBoolean; |
16 |
> |
import java.util.concurrent.atomic.AtomicInteger; |
17 |
|
|
18 |
|
public class PhaserTest extends JSR166TestCase { |
19 |
|
|
158 |
|
phaser.bulkRegister(Integer.MAX_VALUE); |
159 |
|
shouldThrow(); |
160 |
|
} catch (IllegalStateException success) {} |
161 |
+ |
|
162 |
+ |
assertEquals(0, phaser.bulkRegister(0)); |
163 |
+ |
assertState(phaser, 0, maxParties, maxParties); |
164 |
|
} |
165 |
|
|
166 |
|
/** |
204 |
|
*/ |
205 |
|
public void testBulkRegister2() { |
206 |
|
Phaser phaser = new Phaser(); |
207 |
+ |
assertEquals(0, phaser.bulkRegister(0)); |
208 |
+ |
assertState(phaser, 0, 0, 0); |
209 |
|
assertEquals(0, phaser.bulkRegister(20)); |
210 |
|
assertState(phaser, 0, 20, 20); |
211 |
|
} |