@Override TestSuite computeMultimapAsMapGetTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<ListMultimap<K, V>, Entry<K, V>>> parentBuilder) { Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures()); if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) { return new TestSuite(); } else { return ListTestSuiteBuilder.using( new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(features) .named(parentBuilder.getName() + ".asMap[].get[key]") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); } }
@Override TestSuite computeMultimapAsMapGetTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>> parentBuilder) { Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures()); if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) { return new TestSuite(); } else { return SetTestSuiteBuilder.using( new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(features) .named(parentBuilder.getName() + ".asMap[].get[key]") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); } }
@Override TestSuite computeMultimapAsMapGetTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>> parentBuilder) { Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures()); if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) { return new TestSuite(); } else { return SortedSetTestSuiteBuilder.using( new SetMultimapTestSuiteBuilder.MultimapAsMapGetGenerator<K, V>( parentBuilder.getSubjectGenerator())) .withFeatures(features) .named(parentBuilder.getName() + ".asMap[].get[key]") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); } }
TestSuite computeMultimapAsMapGetTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>> parentBuilder) { Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures()); if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) { return new TestSuite(); } else { return CollectionTestSuiteBuilder.using( new MultimapAsMapGetGenerator<K, V, M>(parentBuilder.getSubjectGenerator())) .withFeatures(features) .named(parentBuilder.getName() + ".asMap[].get[key]") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); } }
@Override TestSuite computeMultimapAsMapGetTestSuite( FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<ListMultimap<K, V>, Entry<K, V>>> parentBuilder) { Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures()); if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) { return new TestSuite(); } else { return ListTestSuiteBuilder.using( new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(features) .named(parentBuilder.getName() + ".asMap[].get[key]") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); } }
@Override TestSuite computeMultimapAsMapGetTestSuite( FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>> parentBuilder) { Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures()); if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) { return new TestSuite(); } else { return SetTestSuiteBuilder.using( new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(features) .named(parentBuilder.getName() + ".asMap[].get[key]") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); } }
@Override TestSuite computeMultimapAsMapGetTestSuite( FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>> parentBuilder) { Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures()); if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) { return new TestSuite(); } else { return SortedSetTestSuiteBuilder.using( new SetMultimapTestSuiteBuilder.MultimapAsMapGetGenerator<K, V>( parentBuilder.getSubjectGenerator())) .withFeatures(features) .named(parentBuilder.getName() + ".asMap[].get[key]") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); } }
@Override TestSuite computeMultimapGetTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<ListMultimap<K, V>, Entry<K, V>>> parentBuilder) { return ListTestSuiteBuilder.using( new MultimapGetGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + ".get[key]") .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)); derivedSuites.add(createElementSetTestSuite(parentBuilder)); if (!parentBuilder.getFeatures().contains(NoRecurse.NO_ENTRY_SET)) { derivedSuites.add( SetTestSuiteBuilder.using(new EntrySetGenerator<E>(parentBuilder.getSubjectGenerator())) .named(getName() + ".entrySet") .withFeatures(computeEntrySetFeatures(parentBuilder.getFeatures())) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite()); } if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) { derivedSuites.add( MultisetTestSuiteBuilder.using( new ReserializedMultisetGenerator<E>(parentBuilder.getSubjectGenerator())) .named(getName() + " reserialized") .withFeatures(computeReserializedMultisetFeatures(parentBuilder.getFeatures())) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite()); } return derivedSuites; }
TestSuite createElementSetTestSuite( FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) { return SetTestSuiteBuilder.using( new ElementSetGenerator<E>(parentBuilder.getSubjectGenerator())) .named(getName() + ".elementSet") .withFeatures(computeElementSetFeatures(parentBuilder.getFeatures())) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
@Override TestSuite computeMultimapGetTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>> parentBuilder) { return SetTestSuiteBuilder.using( new MultimapGetGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + ".get[key]") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
@Override TestSuite computeEntriesTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Map.Entry<K, V>>> parentBuilder) { return SetTestSuiteBuilder.using( new EntriesGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(computeEntriesFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + ".entries") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
@Override TestSuite createElementSetTestSuite( FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) { // TODO(lowasser): make a SortedElementSetGenerator return SetTestSuiteBuilder.using( new ElementSetGenerator<E>(parentBuilder.getSubjectGenerator())) .named(getName() + ".elementSet") .withFeatures(computeElementSetFeatures(parentBuilder.getFeatures())) .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
@Override TestSuite computeMultimapGetTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>> parentBuilder) { return SortedSetTestSuiteBuilder.using( new SetMultimapTestSuiteBuilder.MultimapGetGenerator<K, V>( parentBuilder.getSubjectGenerator())) .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + ".get[key]") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
@Override protected List<TestSuite> createDerivedSuites( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>> parentBuilder) { // TODO: Once invariant support is added, supply invariants to each of the // derived suites, to check that mutations to the derived collections are // reflected in the underlying map. List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder); if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) { derivedSuites.add( MultimapTestSuiteBuilder.using( new ReserializedMultimapGenerator<K, V, M>(parentBuilder.getSubjectGenerator())) .withFeatures(computeReserializedMultimapFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + " reserialized") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite()); } derivedSuites.add( MapTestSuiteBuilder.using(new AsMapGenerator<K, V, M>(parentBuilder.getSubjectGenerator())) .withFeatures(computeAsMapFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + ".asMap") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite()); derivedSuites.add(computeEntriesTestSuite(parentBuilder)); derivedSuites.add(computeMultimapGetTestSuite(parentBuilder)); derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder)); derivedSuites.add(computeKeysTestSuite(parentBuilder)); derivedSuites.add(computeValuesTestSuite(parentBuilder)); return derivedSuites; }
TestSuite computeValuesTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>> parentBuilder) { return CollectionTestSuiteBuilder.using( new ValuesGenerator<K, V, M>(parentBuilder.getSubjectGenerator())) .withFeatures(computeValuesFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + ".values") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
TestSuite computeEntriesTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>> parentBuilder) { return CollectionTestSuiteBuilder.using( new EntriesGenerator<K, V, M>(parentBuilder.getSubjectGenerator())) .withFeatures(computeEntriesFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + ".entries") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
TestSuite computeMultimapGetTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>> parentBuilder) { return CollectionTestSuiteBuilder.using( new MultimapGetGenerator<K, V, M>(parentBuilder.getSubjectGenerator())) .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + ".get[key]") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }
TestSuite computeKeysTestSuite( FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>> parentBuilder) { return MultisetTestSuiteBuilder.using( new KeysGenerator<K, V, M>(parentBuilder.getSubjectGenerator())) .withFeatures(computeKeysFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + ".keys") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite(); }