6 |
|
*/ |
7 |
|
|
8 |
|
import java.util.ArrayList; |
9 |
< |
import java.util.Collection; |
9 |
> |
import java.util.List; |
10 |
|
|
11 |
|
import junit.framework.Test; |
12 |
– |
import junit.framework.TestSuite; |
12 |
|
|
13 |
|
public class ArrayListTest extends JSR166TestCase { |
14 |
|
public static void main(String[] args) { |
18 |
|
public static Test suite() { |
19 |
|
class Implementation implements CollectionImplementation { |
20 |
|
public Class<?> klazz() { return ArrayList.class; } |
21 |
< |
public Collection emptyCollection() { return new ArrayList(); } |
21 |
> |
public List emptyCollection() { return new ArrayList(); } |
22 |
|
public Object makeElement(int i) { return i; } |
23 |
|
public boolean isConcurrent() { return false; } |
24 |
|
public boolean permitsNulls() { return true; } |
25 |
|
} |
26 |
< |
return newTestSuite(// ArrayListTest.class, |
27 |
< |
CollectionTest.testSuite(new Implementation())); |
26 |
> |
class SubListImplementation extends Implementation { |
27 |
> |
public List emptyCollection() { |
28 |
> |
return super.emptyCollection().subList(0, 0); |
29 |
> |
} |
30 |
> |
} |
31 |
> |
return newTestSuite( |
32 |
> |
// ArrayListTest.class, |
33 |
> |
CollectionTest.testSuite(new Implementation()), |
34 |
> |
CollectionTest.testSuite(new SubListImplementation())); |
35 |
|
} |
36 |
|
|
37 |
|
} |