22 |
|
} |
23 |
|
|
24 |
|
/** |
25 |
< |
* negative constructor argument throws IAE |
25 |
> |
* negative constructor argument throws IllegalArgumentException |
26 |
|
*/ |
27 |
|
public void testConstructor() { |
28 |
|
try { |
104 |
|
} |
105 |
|
|
106 |
|
/** |
107 |
< |
* await throws IE if interrupted before counted down |
107 |
> |
* await throws InterruptedException if interrupted before counted down |
108 |
|
*/ |
109 |
|
public void testAwait_Interruptible() { |
110 |
|
final CountDownLatch l = new CountDownLatch(1); |
135 |
|
} |
136 |
|
|
137 |
|
/** |
138 |
< |
* timed await throws IE if interrupted before counted down |
138 |
> |
* timed await throws InterruptedException if interrupted before counted down |
139 |
|
*/ |
140 |
|
public void testTimedAwait_Interruptible() { |
141 |
|
final CountDownLatch l = new CountDownLatch(1); |
173 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
174 |
|
public void realRun() throws InterruptedException { |
175 |
|
assertEquals(1, l.getCount()); |
176 |
+ |
|
177 |
+ |
long startTime = System.nanoTime(); |
178 |
|
assertFalse(l.await(timeoutMillis(), MILLISECONDS)); |
179 |
+ |
assertTrue(millisElapsedSince(startTime) >= timeoutMillis()); |
180 |
+ |
|
181 |
|
assertEquals(1, l.getCount()); |
182 |
|
}}); |
183 |
|
|