424 |
|
* push(null) throws NPE |
425 |
|
*/ |
426 |
|
public void testPushNull() { |
427 |
+ |
LinkedBlockingDeque q = new LinkedBlockingDeque(1); |
428 |
|
try { |
428 |
– |
LinkedBlockingDeque q = new LinkedBlockingDeque(1); |
429 |
|
q.push(null); |
430 |
|
shouldThrow(); |
431 |
|
} catch (NullPointerException success) {} |
435 |
|
* push succeeds if not full; throws ISE if full |
436 |
|
*/ |
437 |
|
public void testPush() { |
438 |
+ |
LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); |
439 |
+ |
for (int i = 0; i < SIZE; ++i) { |
440 |
+ |
Integer x = new Integer(i); |
441 |
+ |
q.push(x); |
442 |
+ |
assertEquals(x, q.peek()); |
443 |
+ |
} |
444 |
+ |
assertEquals(0, q.remainingCapacity()); |
445 |
|
try { |
439 |
– |
LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); |
440 |
– |
for (int i = 0; i < SIZE; ++i) { |
441 |
– |
Integer x = new Integer(i); |
442 |
– |
q.push(x); |
443 |
– |
assertEquals(x, q.peek()); |
444 |
– |
} |
445 |
– |
assertEquals(0, q.remainingCapacity()); |
446 |
|
q.push(new Integer(SIZE)); |
447 |
|
shouldThrow(); |
448 |
|
} catch (IllegalStateException success) {} |