21 |
|
|
22 |
|
public class AbstractQueuedSynchronizerTest extends JSR166TestCase { |
23 |
|
public static void main(String[] args) { |
24 |
< |
junit.textui.TestRunner.run(suite()); |
24 |
> |
main(suite(), args); |
25 |
|
} |
26 |
|
public static Test suite() { |
27 |
|
return new TestSuite(AbstractQueuedSynchronizerTest.class); |
228 |
|
case awaitUntil: |
229 |
|
assertTrue(c.awaitUntil(delayedDate(timeoutMillis))); |
230 |
|
break; |
231 |
+ |
default: |
232 |
+ |
throw new AssertionError(); |
233 |
|
} |
234 |
|
} |
235 |
|
|
249 |
|
long nanosTimeout = MILLISECONDS.toNanos(timeoutMillis); |
250 |
|
long nanosRemaining = c.awaitNanos(nanosTimeout); |
251 |
|
assertTrue(nanosRemaining <= 0); |
252 |
+ |
assertTrue(nanosRemaining > -MILLISECONDS.toNanos(LONG_DELAY_MS)); |
253 |
|
break; |
254 |
|
case awaitUntil: |
255 |
|
assertFalse(c.awaitUntil(delayedDate(timeoutMillis))); |
1201 |
|
public void testTryAcquireSharedNanos_Timeout() { |
1202 |
|
final BooleanLatch l = new BooleanLatch(); |
1203 |
|
final BooleanLatch observedQueued = new BooleanLatch(); |
1201 |
– |
final long timeoutMillis = timeoutMillis(); |
1204 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
1205 |
|
public void realRun() throws InterruptedException { |
1206 |
|
assertFalse(l.isSignalled()); |