public Test testsForCheckedNavigableSet() { return SortedSetTestSuiteBuilder.using( new TestStringSortedSetGenerator() { @Override public NavigableSet<String> create(String[] elements) { NavigableSet<String> innerSet = new TreeSet<String>(); Collections.addAll(innerSet, elements); return Collections.checkedNavigableSet(innerSet, String.class); } }) .named("checkedNavigableSet/TreeSet, natural") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.KNOWN_ORDER, CollectionFeature.SERIALIZABLE, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionFeature.RESTRICTS_ELEMENTS, CollectionSize.ANY) .suppressing(suppressForCheckedNavigableSet()) .createTestSuite(); }
public Test testsForHashSet() { return SetTestSuiteBuilder.using( new TestStringSetGenerator() { @Override public Set<String> create(String[] elements) { return new HashSet<String>(MinimalCollection.of(elements)); } }) .named("HashSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForHashSet()) .createTestSuite(); }
public Test testsForLinkedHashSet() { return SetTestSuiteBuilder.using( new TestStringSetGenerator() { @Override public Set<String> create(String[] elements) { return new LinkedHashSet<String>(MinimalCollection.of(elements)); } }) .named("LinkedHashSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.KNOWN_ORDER, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForLinkedHashSet()) .createTestSuite(); }
public Test testsForEnumSet() { return SetTestSuiteBuilder.using( new TestEnumSetGenerator() { @Override public Set<AnEnum> create(AnEnum[] elements) { return (elements.length == 0) ? EnumSet.noneOf(AnEnum.class) : EnumSet.copyOf(MinimalCollection.of(elements)); } }) .named("EnumSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.KNOWN_ORDER, CollectionFeature.RESTRICTS_ELEMENTS, CollectionSize.ANY) .suppressing(suppressForEnumSet()) .createTestSuite(); }
/** * Tests regular NavigableSet behavior of synchronizedNavigableSet(treeSet); * does not test the fact that it's synchronized. */ public Test testsForSynchronizedNavigableSet() { return NavigableSetTestSuiteBuilder.using( new TestStringSortedSetGenerator() { @Override public SortedSet<String> create(String[] elements) { NavigableSet<String> delegate = new TreeSet<>(MinimalCollection.of(elements)); return Collections.synchronizedNavigableSet(delegate); } }) .named("synchronizedNavigableSet/TreeSet, natural") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.KNOWN_ORDER, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForSynchronizedNavigableSet()) .createTestSuite(); }
public Test testsForTreeSetNatural() { return NavigableSetTestSuiteBuilder.using( new TestStringSortedSetGenerator() { @Override public SortedSet<String> create(String[] elements) { return new TreeSet<String>(MinimalCollection.of(elements)); } }) .named("TreeSet, natural") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.KNOWN_ORDER, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForTreeSetNatural()) .createTestSuite(); }
public Test testsForTreeSetWithComparator() { return NavigableSetTestSuiteBuilder.using( new TestStringSortedSetGenerator() { @Override public SortedSet<String> create(String[] elements) { SortedSet<String> set = new TreeSet<String>(arbitraryNullFriendlyComparator()); Collections.addAll(set, elements); return set; } }) .named("TreeSet, with comparator") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.KNOWN_ORDER, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForTreeSetWithComparator()) .createTestSuite(); }
public Test testsForCheckedSet() { return SetTestSuiteBuilder.using( new TestStringSetGenerator() { @Override public Set<String> create(String[] elements) { Set<String> innerSet = new HashSet<String>(); Collections.addAll(innerSet, elements); return Collections.checkedSet(innerSet, String.class); } }) .named("checkedSet/HashSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.RESTRICTS_ELEMENTS, CollectionSize.ANY) .suppressing(suppressForCheckedSet()) .createTestSuite(); }
public Test testsForCheckedSortedSet() { return SortedSetTestSuiteBuilder.using( new TestStringSortedSetGenerator() { @Override public SortedSet<String> create(String[] elements) { SortedSet<String> innerSet = new TreeSet<String>(); Collections.addAll(innerSet, elements); return Collections.checkedSortedSet(innerSet, String.class); } }) .named("checkedSortedSet/TreeSet, natural") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.KNOWN_ORDER, CollectionFeature.SERIALIZABLE, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionFeature.RESTRICTS_ELEMENTS, CollectionSize.ANY) .suppressing(suppressForCheckedSortedSet()) .createTestSuite(); }
public Test testsForBadlyCollidingHashSet() { return SetTestSuiteBuilder.using( new TestCollidingSetGenerator() { @Override public Set<Object> create(Object... elements) { return new HashSet<Object>(MinimalCollection.of(elements)); } }) .named("badly colliding HashSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionSize.SEVERAL) .suppressing(suppressForHashSet()) .createTestSuite(); }
public Test testsForConcurrentSkipListSetNatural() { return SetTestSuiteBuilder.using( new TestStringSortedSetGenerator() { @Override public SortedSet<String> create(String[] elements) { return new ConcurrentSkipListSet<String>(MinimalCollection.of(elements)); } }) .named("ConcurrentSkipListSet, natural") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.KNOWN_ORDER, CollectionSize.ANY) .suppressing(suppressForConcurrentSkipListSetNatural()) .createTestSuite(); }
public Test testsForConcurrentSkipListSetWithComparator() { return SetTestSuiteBuilder.using( new TestStringSortedSetGenerator() { @Override public SortedSet<String> create(String[] elements) { SortedSet<String> set = new ConcurrentSkipListSet<String>(arbitraryNullFriendlyComparator()); Collections.addAll(set, elements); return set; } }) .named("ConcurrentSkipListSet, with comparator") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.KNOWN_ORDER, CollectionSize.ANY) .suppressing(suppressForConcurrentSkipListSetWithComparator()) .createTestSuite(); }
public Test testsForHashSet() { return SetTestSuiteBuilder .using(new TestStringSetGenerator() { @Override public Set<String> create(String[] elements) { return new HashSet<String>(MinimalCollection.of(elements)); } }) .named("HashSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForHashSet()) .createTestSuite(); }
public Test testsForLinkedHashSet() { return SetTestSuiteBuilder .using(new TestStringSetGenerator() { @Override public Set<String> create(String[] elements) { return new LinkedHashSet<String>(MinimalCollection.of(elements)); } }) .named("LinkedHashSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.KNOWN_ORDER, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForLinkedHashSet()) .createTestSuite(); }
public Test testsForEnumSet() { return SetTestSuiteBuilder .using(new TestEnumSetGenerator() { @Override public Set<AnEnum> create(AnEnum[] elements) { return (elements.length == 0) ? EnumSet.noneOf(AnEnum.class) : EnumSet.copyOf(MinimalCollection.of(elements)); } }) .named("EnumSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.KNOWN_ORDER, CollectionFeature.RESTRICTS_ELEMENTS, CollectionSize.ANY) .suppressing(suppressForEnumSet()) .createTestSuite(); }
public Test testsForTreeSetNatural() { return NavigableSetTestSuiteBuilder .using(new TestStringSortedSetGenerator() { @Override public SortedSet<String> create(String[] elements) { return new TreeSet<String>(MinimalCollection.of(elements)); } }) .named("TreeSet, natural") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.KNOWN_ORDER, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForTreeSetNatural()) .createTestSuite(); }
public Test testsForTreeSetWithComparator() { return NavigableSetTestSuiteBuilder .using(new TestStringSortedSetGenerator() { @Override public SortedSet<String> create(String[] elements) { SortedSet<String> set = new TreeSet<String>(arbitraryNullFriendlyComparator()); Collections.addAll(set, elements); return set; } }) .named("TreeSet, with comparator") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.KNOWN_ORDER, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForTreeSetWithComparator()) .createTestSuite(); }
public Test testsForCheckedSet() { return SetTestSuiteBuilder .using(new TestStringSetGenerator() { @Override public Set<String> create(String[] elements) { Set<String> innerSet = new HashSet<String>(); Collections.addAll(innerSet, elements); return Collections.checkedSet(innerSet, String.class); } }) .named("checkedSet/HashSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.RESTRICTS_ELEMENTS, CollectionSize.ANY) .suppressing(suppressForCheckedSet()) .createTestSuite(); }
public Test testsForBadlyCollidingHashSet() { return SetTestSuiteBuilder .using(new TestCollidingSetGenerator() { @Override public Set<Object> create(Object... elements) { return new HashSet<Object>(MinimalCollection.of(elements)); } }) .named("badly colliding HashSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionSize.SEVERAL) .suppressing(suppressForHashSet()) .createTestSuite(); }
public Test testsForConcurrentSkipListSetNatural() { return SetTestSuiteBuilder .using(new TestStringSortedSetGenerator() { @Override public SortedSet<String> create(String[] elements) { return new ConcurrentSkipListSet<String>(MinimalCollection.of(elements)); } }) .named("ConcurrentSkipListSet, natural") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.KNOWN_ORDER, CollectionSize.ANY) .suppressing(suppressForConcurrentSkipListSetNatural()) .createTestSuite(); }
public Test testsForConcurrentSkipListSetWithComparator() { return SetTestSuiteBuilder .using(new TestStringSortedSetGenerator() { @Override public SortedSet<String> create(String[] elements) { SortedSet<String> set = new ConcurrentSkipListSet<String>(arbitraryNullFriendlyComparator()); Collections.addAll(set, elements); return set; } }) .named("ConcurrentSkipListSet, with comparator") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.KNOWN_ORDER, CollectionSize.ANY) .suppressing(suppressForConcurrentSkipListSetWithComparator()) .createTestSuite(); }
public Test testsForHashSet() { return SetTestSuiteBuilder .using(new TestStringSetGenerator() { @SuppressWarnings("unchecked") @Override public Set<String> create(String[] elements) { Set<String> list = new HashSet<String>(); list.addAll(MinimalCollection.of(elements)); return list; } }) .named("HashSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForHashSet()) .createTestSuite(); // CollectionFeature.ALLOWS_NULL_VALUES, // CollectionFeature.SERIALIZABLE, }
public Test testsForSimpleList() { return SetTestSuiteBuilder .using(new TestStringSetGenerator() { @SuppressWarnings("unchecked") @Override public Set<String> create(String[] elements) { // return (Set<String>) new HashSet<String>(); return (Set<String>) new SimpleSet<String>().withList(MinimalCollection.of(elements)); } }) .named("SimpleList") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForHashSet()) .createTestSuite(); // CollectionFeature.ALLOWS_NULL_VALUES, // CollectionFeature.SERIALIZABLE, }
public static TestSuite suite() throws Exception { return SetTestSuiteBuilder.using(new TestStringSetGenerator() { @Override protected Set<String> create(String[] elements) { ParetoHashSet s = new ParetoHashSet(); for (String element : elements) { s.add(element); } return s; } }) .named("ParetoHashSetTestSuite") .withFeatures(SetFeature.GENERAL_PURPOSE, CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.ALLOWS_NULL_QUERIES, CollectionFeature.REMOVE_OPERATIONS, CollectionFeature.SERIALIZABLE) .createTestSuite(); }
public Test testsForCheckedNavigableSet() { return SortedSetTestSuiteBuilder.using( new TestStringSortedSetGenerator() { @Override public NavigableSet<String> create(String[] elements) { NavigableSet<String> innerSet = new TreeSet<>(); Collections.addAll(innerSet, elements); return Collections.checkedNavigableSet(innerSet, String.class); } }) .named("checkedNavigableSet/TreeSet, natural") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.KNOWN_ORDER, CollectionFeature.SERIALIZABLE, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionFeature.RESTRICTS_ELEMENTS, CollectionSize.ANY) .suppressing(suppressForCheckedNavigableSet()) .createTestSuite(); }
public Test testsForHashSet() { return SetTestSuiteBuilder.using( new TestStringSetGenerator() { @Override public Set<String> create(String[] elements) { return new HashSet<>(MinimalCollection.of(elements)); } }) .named("HashSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForHashSet()) .createTestSuite(); }
public Test testsForLinkedHashSet() { return SetTestSuiteBuilder.using( new TestStringSetGenerator() { @Override public Set<String> create(String[] elements) { return new LinkedHashSet<>(MinimalCollection.of(elements)); } }) .named("LinkedHashSet") .withFeatures( SetFeature.GENERAL_PURPOSE, CollectionFeature.SERIALIZABLE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.KNOWN_ORDER, CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionSize.ANY) .suppressing(suppressForLinkedHashSet()) .createTestSuite(); }