Java Code Examples for com.google.common.collect.testing.OneSizeTestContainerGenerator

The following are top voted examples for showing how to use com.google.common.collect.testing.OneSizeTestContainerGenerator. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: guava-mock   File: ListMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 2
Project: guava-mock   File: SetMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 3
Project: guava-mock   File: SortedSetMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 4
Project: guava-mock   File: MultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
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();
  }
}
 
Example 5
Project: googles-monorepo-demo   File: ListMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 6
Project: googles-monorepo-demo   File: SetMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 7
Project: googles-monorepo-demo   File: MultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
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();
  }
}
 
Example 8
Project: guava-libraries   File: ListMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 9
Project: guava-libraries   File: SetMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 10
Project: guava-libraries   File: SortedSetMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 11
Project: guava   File: ListMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 12
Project: guava   File: SetMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 13
Project: guava   File: SortedSetMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 14
Project: guava   File: ListMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 15
Project: guava   File: SetMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 16
Project: guava   File: SortedSetMultimapTestSuiteBuilder.java   View source code 6 votes vote down vote up
@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();
  }
}
 
Example 17
Project: guava-mock   File: ListMultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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();
}
 
Example 18
Project: guava-mock   File: MultisetTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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;
}
 
Example 19
Project: guava-mock   File: MultisetTestSuiteBuilder.java   View source code 5 votes vote down vote up
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();
}
 
Example 20
Project: guava-mock   File: SetMultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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();
}
 
Example 21
Project: guava-mock   File: SetMultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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();
}
 
Example 22
Project: guava-mock   File: SortedMultisetTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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();
}
 
Example 23
Project: guava-mock   File: SortedSetMultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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();
}
 
Example 24
Project: guava-mock   File: DerivedGoogleCollectionGenerators.java   View source code 5 votes vote down vote up
public BiMapValueSetGenerator(
    OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>> mapGenerator) {
  this.mapGenerator = mapGenerator;
  final SampleElements<Map.Entry<K, V>> mapSamples = this.mapGenerator.samples();
  this.samples =
      new SampleElements<V>(
          mapSamples.e0().getValue(),
          mapSamples.e1().getValue(),
          mapSamples.e2().getValue(),
          mapSamples.e3().getValue(),
          mapSamples.e4().getValue());
}
 
Example 25
Project: guava-mock   File: MultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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;
}
 
Example 26
Project: guava-mock   File: MultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
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();
}
 
Example 27
Project: guava-mock   File: MultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
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();
}
 
Example 28
Project: guava-mock   File: MultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
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();
}
 
Example 29
Project: guava-mock   File: MultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
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();
}
 
Example 30
Project: googles-monorepo-demo   File: ListMultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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();
}
 
Example 31
Project: googles-monorepo-demo   File: MultisetTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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;
}
 
Example 32
Project: googles-monorepo-demo   File: MultisetTestSuiteBuilder.java   View source code 5 votes vote down vote up
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();
}
 
Example 33
Project: googles-monorepo-demo   File: SetMultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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();
}
 
Example 34
Project: googles-monorepo-demo   File: SetMultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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();
}
 
Example 35
Project: googles-monorepo-demo   File: SortedMultisetTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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();
}
 
Example 36
Project: googles-monorepo-demo   File: SortedSetMultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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();
}
 
Example 37
Project: googles-monorepo-demo   File: SortedSetMultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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();
  }
}
 
Example 38
Project: googles-monorepo-demo   File: DerivedGoogleCollectionGenerators.java   View source code 5 votes vote down vote up
public BiMapValueSetGenerator(
    OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>> mapGenerator) {
  this.mapGenerator = mapGenerator;
  final SampleElements<Map.Entry<K, V>> mapSamples = this.mapGenerator.samples();
  this.samples =
      new SampleElements<V>(
          mapSamples.e0().getValue(),
          mapSamples.e1().getValue(),
          mapSamples.e2().getValue(),
          mapSamples.e3().getValue(),
          mapSamples.e4().getValue());
}
 
Example 39
Project: googles-monorepo-demo   File: MultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
@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;
}
 
Example 40
Project: googles-monorepo-demo   File: MultimapTestSuiteBuilder.java   View source code 5 votes vote down vote up
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();
}