25 |
|
} |
26 |
|
|
27 |
|
public static Test suite() { |
28 |
< |
return new TestSuite(ConcurrentLinkedDequeTest.class); |
28 |
> |
class Implementation implements CollectionImplementation { |
29 |
> |
public Class<?> klazz() { return ConcurrentLinkedDeque.class; } |
30 |
> |
public Collection emptyCollection() { return new ConcurrentLinkedDeque(); } |
31 |
> |
public Object makeElement(int i) { return i; } |
32 |
> |
public boolean isConcurrent() { return true; } |
33 |
> |
public boolean permitsNulls() { return false; } |
34 |
> |
} |
35 |
> |
return newTestSuite(ConcurrentLinkedDequeTest.class, |
36 |
> |
CollectionTest.testSuite(new Implementation())); |
37 |
|
} |
38 |
|
|
39 |
|
/** |
40 |
|
* Returns a new deque of given size containing consecutive |
41 |
< |
* Integers 0 ... n. |
41 |
> |
* Integers 0 ... n - 1. |
42 |
|
*/ |
43 |
|
private ConcurrentLinkedDeque<Integer> populatedDeque(int n) { |
44 |
|
ConcurrentLinkedDeque<Integer> q = new ConcurrentLinkedDeque<Integer>(); |
47 |
|
assertTrue(q.offer(new Integer(i))); |
48 |
|
assertFalse(q.isEmpty()); |
49 |
|
assertEquals(n, q.size()); |
50 |
+ |
assertEquals((Integer) 0, q.peekFirst()); |
51 |
+ |
assertEquals((Integer) (n - 1), q.peekLast()); |
52 |
|
return q; |
53 |
|
} |
54 |
|
|