@Override protected List<TestSuite> createDerivedSuites( FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) { List<TestSuite> derivedSuites = new ArrayList<TestSuite>(super.createDerivedSuites(parentBuilder)); if (!parentBuilder.getFeatures().contains(SUBSET_VIEW)) { // Other combinations are inherited from SortedSetTestSuiteBuilder. derivedSuites.add(createSubsetSuite(parentBuilder, Bound.NO_BOUND, Bound.INCLUSIVE)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.EXCLUSIVE, Bound.NO_BOUND)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.EXCLUSIVE, Bound.EXCLUSIVE)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.EXCLUSIVE, Bound.INCLUSIVE)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.INCLUSIVE, Bound.INCLUSIVE)); } if (!parentBuilder.getFeatures().contains(DESCENDING_VIEW)) { derivedSuites.add(createDescendingSuite(parentBuilder)); } return derivedSuites; }
@Override NavigableSet<E> createSubSet(SortedSet<E> sortedSet, E firstExclusive, E lastExclusive) { NavigableSet<E> set = (NavigableSet<E>) sortedSet; if (from == Bound.NO_BOUND && to == Bound.INCLUSIVE) { return set.headSet(lastInclusive, true); } else if (from == Bound.EXCLUSIVE && to == Bound.NO_BOUND) { return set.tailSet(firstExclusive, false); } else if (from == Bound.EXCLUSIVE && to == Bound.EXCLUSIVE) { return set.subSet(firstExclusive, false, lastExclusive, false); } else if (from == Bound.EXCLUSIVE && to == Bound.INCLUSIVE) { return set.subSet(firstExclusive, false, lastInclusive, true); } else if (from == Bound.INCLUSIVE && to == Bound.INCLUSIVE) { return set.subSet(firstInclusive, true, lastInclusive, true); } else { return (NavigableSet<E>) super.createSubSet(set, firstExclusive, lastExclusive); } }
/** * Creates a suite whose set has some elements filtered out of view. * * <p>Because the set may be ascending or descending, this test must derive * the relative order of these extreme values rather than relying on their * regular sort ordering. */ final TestSuite createSubsetSuite( final FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder, final Bound from, final Bound to) { final TestSortedSetGenerator<E> delegate = (TestSortedSetGenerator<E>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<Feature<?>>(); features.addAll(parentBuilder.getFeatures()); features.remove(CollectionFeature.ALLOWS_NULL_VALUES); features.add(CollectionFeature.SUBSET_VIEW); return newBuilderUsing(delegate, to, from) .named(parentBuilder.getName() + " subSet " + from + "-" + to) .withFeatures(features) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
@Override protected List<TestSuite> createDerivedSuites( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder) { List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder); if (!parentBuilder.getFeatures().contains(NoRecurse.DESCENDING)) { derivedSuites.add(createDescendingSuite(parentBuilder)); } if (!parentBuilder.getFeatures().contains(NoRecurse.SUBMAP)) { // Other combinations are inherited from SortedMapTestSuiteBuilder. derivedSuites.add(createSubmapSuite(parentBuilder, Bound.NO_BOUND, Bound.INCLUSIVE)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.EXCLUSIVE, Bound.NO_BOUND)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.EXCLUSIVE, Bound.EXCLUSIVE)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.EXCLUSIVE, Bound.INCLUSIVE)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.INCLUSIVE, Bound.INCLUSIVE)); } return derivedSuites; }
@Override NavigableMap<K, V> createSubMap(SortedMap<K, V> sortedMap, K firstExclusive, K lastExclusive) { NavigableMap<K, V> map = (NavigableMap<K, V>) sortedMap; if (from == Bound.NO_BOUND && to == Bound.INCLUSIVE) { return map.headMap(lastInclusive, true); } else if (from == Bound.EXCLUSIVE && to == Bound.NO_BOUND) { return map.tailMap(firstExclusive, false); } else if (from == Bound.EXCLUSIVE && to == Bound.EXCLUSIVE) { return map.subMap(firstExclusive, false, lastExclusive, false); } else if (from == Bound.EXCLUSIVE && to == Bound.INCLUSIVE) { return map.subMap(firstExclusive, false, lastInclusive, true); } else if (from == Bound.INCLUSIVE && to == Bound.INCLUSIVE) { return map.subMap(firstInclusive, true, lastInclusive, true); } else { return (NavigableMap<K, V>) super.createSubMap(map, firstExclusive, lastExclusive); } }
/** * Creates a suite whose map has some elements filtered out of view. * * <p>Because the map may be ascending or descending, this test must derive * the relative order of these extreme values rather than relying on their * regular sort ordering. */ final TestSuite createSubmapSuite( final FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder, final Bound from, final Bound to) { final TestSortedMapGenerator<K, V> delegate = (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<Feature<?>>(); features.add(NoRecurse.SUBMAP); features.addAll(parentBuilder.getFeatures()); return newBuilderUsing(delegate, to, from) .named(parentBuilder.getName() + " subMap " + from + "-" + to) .withFeatures(features) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
@Override protected List<TestSuite> createDerivedSuites(FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) { List<TestSuite> derivedSuites = new ArrayList<TestSuite>( super.createDerivedSuites(parentBuilder)); if (!parentBuilder.getFeatures().contains(CollectionFeature.SUBSET_VIEW)) { // Other combinations are inherited from SortedSetTestSuiteBuilder. derivedSuites.add(createSubsetSuite(parentBuilder, Bound.NO_BOUND, Bound.INCLUSIVE)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.EXCLUSIVE, Bound.NO_BOUND)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.EXCLUSIVE, Bound.EXCLUSIVE)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.EXCLUSIVE, Bound.INCLUSIVE)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.INCLUSIVE, Bound.INCLUSIVE)); } if (!parentBuilder.getFeatures().contains(CollectionFeature.DESCENDING_VIEW)) { derivedSuites.add(createDescendingSuite(parentBuilder)); } return derivedSuites; }
/** * Creates a suite whose set has some elements filtered out of view. * * <p>Because the set may be ascending or descending, this test must derive * the relative order of these extreme values rather than relying on their * regular sort ordering. */ final TestSuite createSubsetSuite(final FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder, final Bound from, final Bound to) { final TestSortedSetGenerator<E> delegate = (TestSortedSetGenerator<E>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<Feature<?>>(); features.addAll(parentBuilder.getFeatures()); features.remove(CollectionFeature.ALLOWS_NULL_VALUES); features.add(CollectionFeature.SUBSET_VIEW); return newBuilderUsing(delegate, to, from) .named(parentBuilder.getName() + " subSet " + from + "-" + to) .withFeatures(features) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
@Override protected List<TestSuite> createDerivedSuites(FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder) { List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder); if (!parentBuilder.getFeatures().contains(NoRecurse.DESCENDING)) { derivedSuites.add(createDescendingSuite(parentBuilder)); } if (!parentBuilder.getFeatures().contains(NoRecurse.SUBMAP)) { // Other combinations are inherited from SortedMapTestSuiteBuilder. derivedSuites.add(createSubmapSuite(parentBuilder, Bound.NO_BOUND, Bound.INCLUSIVE)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.EXCLUSIVE, Bound.NO_BOUND)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.EXCLUSIVE, Bound.EXCLUSIVE)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.EXCLUSIVE, Bound.INCLUSIVE)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.INCLUSIVE, Bound.INCLUSIVE)); } return derivedSuites; }
/** * Creates a suite whose map has some elements filtered out of view. * * <p>Because the map may be ascending or descending, this test must derive * the relative order of these extreme values rather than relying on their * regular sort ordering. */ final TestSuite createSubmapSuite(final FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder, final Bound from, final Bound to) { final TestSortedMapGenerator<K, V> delegate = (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<Feature<?>>(); features.add(NoRecurse.SUBMAP); features.addAll(parentBuilder.getFeatures()); return newBuilderUsing(delegate, to, from) .named(parentBuilder.getName() + " subMap " + from + "-" + to) .withFeatures(features) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
@Override protected List<TestSuite> createDerivedSuites( FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) { List<TestSuite> derivedSuites = new ArrayList<>(super.createDerivedSuites(parentBuilder)); if (!parentBuilder.getFeatures().contains(SUBSET_VIEW)) { // Other combinations are inherited from SortedSetTestSuiteBuilder. derivedSuites.add(createSubsetSuite(parentBuilder, Bound.NO_BOUND, Bound.INCLUSIVE)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.EXCLUSIVE, Bound.NO_BOUND)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.EXCLUSIVE, Bound.EXCLUSIVE)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.EXCLUSIVE, Bound.INCLUSIVE)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.INCLUSIVE, Bound.INCLUSIVE)); } if (!parentBuilder.getFeatures().contains(DESCENDING_VIEW)) { derivedSuites.add(createDescendingSuite(parentBuilder)); } return derivedSuites; }
/** * Creates a suite whose set has some elements filtered out of view. * * <p>Because the set may be ascending or descending, this test must derive the relative order of * these extreme values rather than relying on their regular sort ordering. */ final TestSuite createSubsetSuite( final FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder, final Bound from, final Bound to) { final TestSortedSetGenerator<E> delegate = (TestSortedSetGenerator<E>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<>(); features.addAll(parentBuilder.getFeatures()); features.remove(CollectionFeature.ALLOWS_NULL_VALUES); features.add(CollectionFeature.SUBSET_VIEW); return newBuilderUsing(delegate, to, from) .named(parentBuilder.getName() + " subSet " + from + "-" + to) .withFeatures(features) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
/** * Creates a suite whose map has some elements filtered out of view. * * <p>Because the map may be ascending or descending, this test must derive the relative order of * these extreme values rather than relying on their regular sort ordering. */ final TestSuite createSubmapSuite( final FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder, final Bound from, final Bound to) { final TestSortedMapGenerator<K, V> delegate = (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<>(); features.add(NoRecurse.SUBMAP); features.addAll(parentBuilder.getFeatures()); return newBuilderUsing(delegate, to, from) .named(parentBuilder.getName() + " subMap " + from + "-" + to) .withFeatures(features) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
@Override protected List<TestSuite> createDerivedSuites( FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) { List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder); if (!parentBuilder.getFeatures().contains(CollectionFeature.SUBSET_VIEW)) { derivedSuites.add(createSubsetSuite(parentBuilder, Bound.NO_BOUND, Bound.EXCLUSIVE)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.INCLUSIVE, Bound.NO_BOUND)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.INCLUSIVE, Bound.EXCLUSIVE)); } return derivedSuites; }
@Override protected List<TestSuite> createDerivedSuites( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder) { List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder); if (!parentBuilder.getFeatures().contains(NoRecurse.SUBMAP)) { derivedSuites.add(createSubmapSuite(parentBuilder, Bound.NO_BOUND, Bound.EXCLUSIVE)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.INCLUSIVE, Bound.NO_BOUND)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.INCLUSIVE, Bound.EXCLUSIVE)); } return derivedSuites; }
@Override protected List<TestSuite> createDerivedSuites(FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) { List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder); if (!parentBuilder.getFeatures().contains(CollectionFeature.SUBSET_VIEW)) { derivedSuites.add(createSubsetSuite(parentBuilder, Bound.NO_BOUND, Bound.EXCLUSIVE)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.INCLUSIVE, Bound.NO_BOUND)); derivedSuites.add(createSubsetSuite(parentBuilder, Bound.INCLUSIVE, Bound.EXCLUSIVE)); } return derivedSuites; }
@Override protected List<TestSuite> createDerivedSuites(FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder) { List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder); if (!parentBuilder.getFeatures().contains(NoRecurse.SUBMAP)) { derivedSuites.add(createSubmapSuite(parentBuilder, Bound.NO_BOUND, Bound.EXCLUSIVE)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.INCLUSIVE, Bound.NO_BOUND)); derivedSuites.add(createSubmapSuite(parentBuilder, Bound.INCLUSIVE, Bound.EXCLUSIVE)); } return derivedSuites; }