5 |
|
* Other contributors include John Vint |
6 |
|
*/ |
7 |
|
|
8 |
< |
import junit.framework.*; |
9 |
< |
import java.util.Arrays; |
8 |
> |
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
9 |
> |
|
10 |
|
import java.util.ArrayList; |
11 |
+ |
import java.util.Arrays; |
12 |
|
import java.util.Collection; |
13 |
|
import java.util.Iterator; |
14 |
|
import java.util.List; |
19 |
|
import java.util.concurrent.Executors; |
20 |
|
import java.util.concurrent.ExecutorService; |
21 |
|
import java.util.concurrent.LinkedTransferQueue; |
22 |
< |
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
23 |
< |
import static java.util.concurrent.TimeUnit.NANOSECONDS; |
22 |
> |
|
23 |
> |
import junit.framework.Test; |
24 |
|
|
25 |
|
@SuppressWarnings({"unchecked", "rawtypes"}) |
26 |
|
public class LinkedTransferQueueTest extends JSR166TestCase { |
626 |
|
Queue x = populatedQueue(SIZE); |
627 |
|
Queue y = serialClone(x); |
628 |
|
|
629 |
< |
assertTrue(x != y); |
629 |
> |
assertNotSame(y, x); |
630 |
|
assertEquals(x.size(), y.size()); |
631 |
|
assertEquals(x.toString(), y.toString()); |
632 |
|
assertTrue(Arrays.equals(x.toArray(), y.toArray())); |
697 |
|
assertEquals(SIZE - k, q.size()); |
698 |
|
for (int j = 0; j < k; ++j) |
699 |
|
assertEquals(j, l.get(j)); |
700 |
< |
while (q.poll() != null) |
700 |
< |
; |
700 |
> |
do {} while (q.poll() != null); |
701 |
|
} |
702 |
|
} |
703 |
|
|
1013 |
|
assertFalse(q.isEmpty()); |
1014 |
|
return q; |
1015 |
|
} |
1016 |
+ |
|
1017 |
+ |
/** |
1018 |
+ |
* remove(null), contains(null) always return false |
1019 |
+ |
*/ |
1020 |
+ |
public void testNeverContainsNull() { |
1021 |
+ |
Collection<?>[] qs = { |
1022 |
+ |
new LinkedTransferQueue<Object>(), |
1023 |
+ |
populatedQueue(2), |
1024 |
+ |
}; |
1025 |
+ |
|
1026 |
+ |
for (Collection<?> q : qs) { |
1027 |
+ |
assertFalse(q.contains(null)); |
1028 |
+ |
assertFalse(q.remove(null)); |
1029 |
+ |
} |
1030 |
+ |
} |
1031 |
|
} |