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