Przemyslaw Szczepaniak | e8b323c | 2016-03-11 15:59:10 +0000 | [diff] [blame] | 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 | package jsr166; |
| 9 | |
| 10 | import java.util.Collection; |
| 11 | |
| 12 | import junit.framework.Test; |
| 13 | |
| 14 | /** |
| 15 | * Contains tests applicable to all Collection implementations. |
| 16 | */ |
Nicholas Sauer | b30ea05 | 2016-05-01 21:22:28 -0700 | [diff] [blame] | 17 | // Android-changed: Made class abstract so it will be ignored by test runners. |
| 18 | abstract class CollectionTest extends JSR166TestCase { |
Przemyslaw Szczepaniak | e8b323c | 2016-03-11 15:59:10 +0000 | [diff] [blame] | 19 | final CollectionImplementation impl; |
| 20 | |
| 21 | /** Tests are parameterized by a Collection implementation. */ |
| 22 | CollectionTest(CollectionImplementation impl, String methodName) { |
| 23 | super(methodName); |
| 24 | this.impl = impl; |
| 25 | } |
| 26 | |
| 27 | public static Test testSuite(CollectionImplementation impl) { |
| 28 | return newTestSuite |
| 29 | (parameterizedTestSuite(CollectionTest.class, |
| 30 | CollectionImplementation.class, |
| 31 | impl), |
| 32 | jdk8ParameterizedTestSuite(CollectionTest.class, |
| 33 | CollectionImplementation.class, |
| 34 | impl)); |
| 35 | } |
| 36 | |
| 37 | /** A test of the CollectionImplementation implementation ! */ |
| 38 | public void testEmptyMeansEmpty() { |
| 39 | assertTrue(impl.emptyCollection().isEmpty()); |
| 40 | assertEquals(0, impl.emptyCollection().size()); |
| 41 | } |
| 42 | |
| 43 | // public void testCollectionDebugFail() { fail(); } |
| 44 | } |