summaryrefslogtreecommitdiff
path: root/jsr166-tests/src/test/java/jsr166/CollectionTest.java
blob: 984439a0ebf3d6753957bcc4102ebca5f3f13752 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Written by Doug Lea and Martin Buchholz with assistance from
 * members of JCP JSR-166 Expert Group and released to the public
 * domain, as explained at
 * http://creativecommons.org/publicdomain/zero/1.0/
 */

package jsr166;

import java.util.Collection;

import junit.framework.Test;

/**
 * Contains tests applicable to all Collection implementations.
 */
class CollectionTest extends JSR166TestCase {
    final CollectionImplementation impl;

    /** Tests are parameterized by a Collection implementation. */
    CollectionTest(CollectionImplementation impl, String methodName) {
        super(methodName);
        this.impl = impl;
    }

    public static Test testSuite(CollectionImplementation impl) {
        return newTestSuite
            (parameterizedTestSuite(CollectionTest.class,
                                    CollectionImplementation.class,
                                    impl),
             jdk8ParameterizedTestSuite(CollectionTest.class,
                                        CollectionImplementation.class,
                                        impl));
    }

    /** A test of the CollectionImplementation implementation ! */
    public void testEmptyMeansEmpty() {
        assertTrue(impl.emptyCollection().isEmpty());
        assertEquals(0, impl.emptyCollection().size());
    }

    // public void testCollectionDebugFail() { fail(); }
}