Search in sources :

Example 1 with ImmutableSetUnsizedBuilderGenerator

use of com.google.common.collect.testing.google.SetGenerators.ImmutableSetUnsizedBuilderGenerator in project guava by google.

the class ImmutableSetTest method suite.

// suite
@GwtIncompatible
public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(SetTestSuiteBuilder.using(new ImmutableSetCopyOfGenerator()).named(ImmutableSetTest.class.getName()).withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
    suite.addTest(SetTestSuiteBuilder.using(new ImmutableSetUnsizedBuilderGenerator()).named(ImmutableSetTest.class.getName() + ", with unsized builder").withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {

        @Override
        protected Set<String> create(String[] elements) {
            ImmutableSet.Builder<String> builder = ImmutableSet.builder();
            builder.forceJdk();
            builder.add(elements);
            return builder.build();
        }
    }).named(ImmutableSetTest.class.getName() + ", with JDK builder").withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
    suite.addTest(SetTestSuiteBuilder.using(new ImmutableSetSizedBuilderGenerator()).named(ImmutableSetTest.class.getName() + ", with exactly sized builder").withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
    suite.addTest(SetTestSuiteBuilder.using(new ImmutableSetTooBigBuilderGenerator()).named(ImmutableSetTest.class.getName() + ", with oversized builder").withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
    suite.addTest(SetTestSuiteBuilder.using(new ImmutableSetTooSmallBuilderGenerator()).named(ImmutableSetTest.class.getName() + ", with undersized builder").withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
    suite.addTest(SetTestSuiteBuilder.using(new ImmutableSetWithBadHashesGenerator()).named(ImmutableSetTest.class.getName() + ", with bad hashes").withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
    suite.addTest(SetTestSuiteBuilder.using(new DegeneratedImmutableSetGenerator()).named(ImmutableSetTest.class.getName() + ", degenerate").withFeatures(CollectionSize.ONE, CollectionFeature.KNOWN_ORDER, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
    suite.addTest(ListTestSuiteBuilder.using(new ImmutableSetAsListGenerator()).named("ImmutableSet.asList").withFeatures(CollectionSize.ANY, CollectionFeature.REJECTS_DUPLICATES_AT_CREATION, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
    suite.addTestSuite(ImmutableSetTest.class);
    suite.addTestSuite(FloodingTest.class);
    return suite;
}
Also used : ImmutableSetUnsizedBuilderGenerator(com.google.common.collect.testing.google.SetGenerators.ImmutableSetUnsizedBuilderGenerator) Set(java.util.Set) Builder(com.google.common.collect.ImmutableSet.Builder) ListTestSuiteBuilder(com.google.common.collect.testing.ListTestSuiteBuilder) SetTestSuiteBuilder(com.google.common.collect.testing.SetTestSuiteBuilder) ImmutableSetTooBigBuilderGenerator(com.google.common.collect.testing.google.SetGenerators.ImmutableSetTooBigBuilderGenerator) ImmutableSetCopyOfGenerator(com.google.common.collect.testing.google.SetGenerators.ImmutableSetCopyOfGenerator) DegeneratedImmutableSetGenerator(com.google.common.collect.testing.google.SetGenerators.DegeneratedImmutableSetGenerator) ImmutableSetAsListGenerator(com.google.common.collect.testing.google.SetGenerators.ImmutableSetAsListGenerator) TestStringSetGenerator(com.google.common.collect.testing.TestStringSetGenerator) TestSuite(junit.framework.TestSuite) ImmutableSetWithBadHashesGenerator(com.google.common.collect.testing.google.SetGenerators.ImmutableSetWithBadHashesGenerator) ImmutableSetSizedBuilderGenerator(com.google.common.collect.testing.google.SetGenerators.ImmutableSetSizedBuilderGenerator) ImmutableSetTooSmallBuilderGenerator(com.google.common.collect.testing.google.SetGenerators.ImmutableSetTooSmallBuilderGenerator) GwtIncompatible(com.google.common.annotations.GwtIncompatible)

Aggregations

GwtIncompatible (com.google.common.annotations.GwtIncompatible)1 Builder (com.google.common.collect.ImmutableSet.Builder)1 ListTestSuiteBuilder (com.google.common.collect.testing.ListTestSuiteBuilder)1 SetTestSuiteBuilder (com.google.common.collect.testing.SetTestSuiteBuilder)1 TestStringSetGenerator (com.google.common.collect.testing.TestStringSetGenerator)1 DegeneratedImmutableSetGenerator (com.google.common.collect.testing.google.SetGenerators.DegeneratedImmutableSetGenerator)1 ImmutableSetAsListGenerator (com.google.common.collect.testing.google.SetGenerators.ImmutableSetAsListGenerator)1 ImmutableSetCopyOfGenerator (com.google.common.collect.testing.google.SetGenerators.ImmutableSetCopyOfGenerator)1 ImmutableSetSizedBuilderGenerator (com.google.common.collect.testing.google.SetGenerators.ImmutableSetSizedBuilderGenerator)1 ImmutableSetTooBigBuilderGenerator (com.google.common.collect.testing.google.SetGenerators.ImmutableSetTooBigBuilderGenerator)1 ImmutableSetTooSmallBuilderGenerator (com.google.common.collect.testing.google.SetGenerators.ImmutableSetTooSmallBuilderGenerator)1 ImmutableSetUnsizedBuilderGenerator (com.google.common.collect.testing.google.SetGenerators.ImmutableSetUnsizedBuilderGenerator)1 ImmutableSetWithBadHashesGenerator (com.google.common.collect.testing.google.SetGenerators.ImmutableSetWithBadHashesGenerator)1 Set (java.util.Set)1 TestSuite (junit.framework.TestSuite)1