1 |
/* |
2 |
* Written by Doug Lea and Martin Buchholz with assistance from |
3 |
* members of JCP JSR-166 Expert Group and released to the public |
4 |
* domain, as explained at |
5 |
* http://creativecommons.org/publicdomain/zero/1.0/ |
6 |
*/ |
7 |
|
8 |
import java.util.Collection; |
9 |
|
10 |
import junit.framework.Test; |
11 |
|
12 |
/** |
13 |
* Contains tests applicable to all Collection implementations. |
14 |
*/ |
15 |
public class CollectionTest extends JSR166TestCase { |
16 |
final CollectionImplementation impl; |
17 |
|
18 |
/** Tests are parameterized by a Collection implementation. */ |
19 |
CollectionTest(CollectionImplementation impl, String methodName) { |
20 |
super(methodName); |
21 |
this.impl = impl; |
22 |
} |
23 |
|
24 |
public static Test testSuite(CollectionImplementation impl) { |
25 |
return newTestSuite |
26 |
(parameterizedTestSuite(CollectionTest.class, |
27 |
CollectionImplementation.class, |
28 |
impl), |
29 |
jdk8ParameterizedTestSuite(CollectionTest.class, |
30 |
CollectionImplementation.class, |
31 |
impl)); |
32 |
} |
33 |
|
34 |
/** A test of the CollectionImplementation implementation ! */ |
35 |
public void testEmptyMeansEmpty() { |
36 |
assertTrue(impl.emptyCollection().isEmpty()); |
37 |
assertEquals(0, impl.emptyCollection().size()); |
38 |
} |
39 |
|
40 |
// public void testCollectionDebugFail() { fail(); } |
41 |
} |