108 |
|
*/ |
109 |
|
public void testConstructor5() { |
110 |
|
Integer[] ints = new Integer[SIZE]; |
111 |
< |
for (int i = 0; i < SIZE-1; ++i) |
111 |
> |
for (int i = 0; i < SIZE - 1; ++i) |
112 |
|
ints[i] = new Integer(i); |
113 |
|
Collection<Integer> elements = Arrays.asList(ints); |
114 |
|
try { |
155 |
|
assertEquals(i, q.remove()); |
156 |
|
} |
157 |
|
for (int i = 0; i < SIZE; ++i) { |
158 |
< |
assertEquals(SIZE-i, q.remainingCapacity()); |
158 |
> |
assertEquals(SIZE - i, q.remainingCapacity()); |
159 |
|
assertEquals(SIZE, q.size() + q.remainingCapacity()); |
160 |
|
assertTrue(q.add(i)); |
161 |
|
} |
202 |
|
public void testAddAll3() { |
203 |
|
LinkedBlockingQueue q = new LinkedBlockingQueue(SIZE); |
204 |
|
Integer[] ints = new Integer[SIZE]; |
205 |
< |
for (int i = 0; i < SIZE-1; ++i) |
205 |
> |
for (int i = 0; i < SIZE - 1; ++i) |
206 |
|
ints[i] = new Integer(i); |
207 |
|
Collection<Integer> elements = Arrays.asList(ints); |
208 |
|
try { |
574 |
|
assertTrue(changed); |
575 |
|
|
576 |
|
assertTrue(q.containsAll(p)); |
577 |
< |
assertEquals(SIZE-i, q.size()); |
577 |
> |
assertEquals(SIZE - i, q.size()); |
578 |
|
p.remove(); |
579 |
|
} |
580 |
|
} |
587 |
|
LinkedBlockingQueue q = populatedQueue(SIZE); |
588 |
|
LinkedBlockingQueue p = populatedQueue(i); |
589 |
|
assertTrue(q.removeAll(p)); |
590 |
< |
assertEquals(SIZE-i, q.size()); |
590 |
> |
assertEquals(SIZE - i, q.size()); |
591 |
|
for (int j = 0; j < i; ++j) { |
592 |
|
Integer x = (Integer)(p.remove()); |
593 |
|
assertFalse(q.contains(x)); |
814 |
|
final LinkedBlockingQueue q = populatedQueue(SIZE); |
815 |
|
Thread t = new Thread(new CheckedRunnable() { |
816 |
|
public void realRun() throws InterruptedException { |
817 |
< |
q.put(new Integer(SIZE+1)); |
817 |
> |
q.put(new Integer(SIZE + 1)); |
818 |
|
}}); |
819 |
|
|
820 |
|
t.start(); |
839 |
|
q.drainTo(l, i); |
840 |
|
int k = (i < SIZE) ? i : SIZE; |
841 |
|
assertEquals(k, l.size()); |
842 |
< |
assertEquals(SIZE-k, q.size()); |
842 |
> |
assertEquals(SIZE - k, q.size()); |
843 |
|
for (int j = 0; j < k; ++j) |
844 |
|
assertEquals(l.get(j), new Integer(j)); |
845 |
|
do {} while (q.poll() != null); |