32 |
|
} |
33 |
|
|
34 |
|
public static void main(String[] args) { |
35 |
< |
junit.textui.TestRunner.run(suite()); |
35 |
> |
main(suite(), args); |
36 |
|
} |
37 |
|
|
38 |
|
public static Test suite() { |
78 |
|
*/ |
79 |
|
public void testConstructor4() { |
80 |
|
Integer[] ints = new Integer[SIZE]; |
81 |
< |
for (int i = 0; i < SIZE-1; ++i) |
81 |
> |
for (int i = 0; i < SIZE - 1; ++i) |
82 |
|
ints[i] = i; |
83 |
|
Collection<Integer> elements = Arrays.asList(ints); |
84 |
|
try { |
115 |
|
* remainingCapacity() always returns Integer.MAX_VALUE |
116 |
|
*/ |
117 |
|
public void testRemainingCapacity() { |
118 |
< |
LinkedTransferQueue<Integer> q = populatedQueue(SIZE); |
118 |
> |
BlockingQueue q = populatedQueue(SIZE); |
119 |
|
for (int i = 0; i < SIZE; ++i) { |
120 |
|
assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); |
121 |
|
assertEquals(SIZE - i, q.size()); |
122 |
< |
q.remove(); |
122 |
> |
assertEquals(i, q.remove()); |
123 |
|
} |
124 |
|
for (int i = 0; i < SIZE; ++i) { |
125 |
|
assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); |
126 |
|
assertEquals(i, q.size()); |
127 |
< |
q.add(i); |
127 |
> |
assertTrue(q.add(i)); |
128 |
|
} |
129 |
|
} |
130 |
|
|
132 |
|
* addAll(this) throws IllegalArgumentException |
133 |
|
*/ |
134 |
|
public void testAddAllSelf() { |
135 |
+ |
LinkedTransferQueue q = populatedQueue(SIZE); |
136 |
|
try { |
136 |
– |
LinkedTransferQueue q = populatedQueue(SIZE); |
137 |
|
q.addAll(q); |
138 |
|
shouldThrow(); |
139 |
|
} catch (IllegalArgumentException success) {} |
144 |
|
* NullPointerException after possibly adding some elements |
145 |
|
*/ |
146 |
|
public void testAddAll3() { |
147 |
+ |
LinkedTransferQueue q = new LinkedTransferQueue(); |
148 |
+ |
Integer[] ints = new Integer[SIZE]; |
149 |
+ |
for (int i = 0; i < SIZE - 1; ++i) |
150 |
+ |
ints[i] = i; |
151 |
|
try { |
148 |
– |
LinkedTransferQueue q = new LinkedTransferQueue(); |
149 |
– |
Integer[] ints = new Integer[SIZE]; |
150 |
– |
for (int i = 0; i < SIZE - 1; ++i) { |
151 |
– |
ints[i] = i; |
152 |
– |
} |
152 |
|
q.addAll(Arrays.asList(ints)); |
153 |
|
shouldThrow(); |
154 |
|
} catch (NullPointerException success) {} |
861 |
|
* tryTransfer(null) throws NullPointerException |
862 |
|
*/ |
863 |
|
public void testTryTransfer1() { |
864 |
+ |
final LinkedTransferQueue q = new LinkedTransferQueue(); |
865 |
|
try { |
866 |
– |
final LinkedTransferQueue q = new LinkedTransferQueue(); |
866 |
|
q.tryTransfer(null); |
867 |
|
shouldThrow(); |
868 |
|
} catch (NullPointerException success) {} |