Java 类com.google.common.collect.testing.features.Feature 实例源码

项目:guava-mock    文件:SortedSetTestSuiteBuilder.java   
/**
 * 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();
}
项目:guava-mock    文件:ListMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:guava-mock    文件:SetMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:guava-mock    文件:BiMapTestSuiteBuilder.java   
private static Set<Feature<?>> computeInverseFeatures(Set<Feature<?>> mapFeatures) {
  Set<Feature<?>> inverseFeatures = new HashSet<Feature<?>>(mapFeatures);

  boolean nullKeys = inverseFeatures.remove(MapFeature.ALLOWS_NULL_KEYS);
  boolean nullValues = inverseFeatures.remove(MapFeature.ALLOWS_NULL_VALUES);

  if (nullKeys) {
    inverseFeatures.add(MapFeature.ALLOWS_NULL_VALUES);
  }
  if (nullValues) {
    inverseFeatures.add(MapFeature.ALLOWS_NULL_KEYS);
  }

  inverseFeatures.add(NoRecurse.INVERSE);
  inverseFeatures.remove(CollectionFeature.KNOWN_ORDER);
  inverseFeatures.add(MapFeature.REJECTS_DUPLICATES_AT_CREATION);

  return inverseFeatures;
}
项目:guava-mock    文件:SortedMultisetTestSuiteBuilder.java   
private TestSuite createReserializedSuite(SortedMultisetTestSuiteBuilder<E> parentBuilder) {
  final TestMultisetGenerator<E> delegate =
      (TestMultisetGenerator<E>) parentBuilder.getSubjectGenerator();

  Set<Feature<?>> features = new HashSet<Feature<?>>();
  features.addAll(parentBuilder.getFeatures());
  features.remove(SERIALIZABLE);
  features.remove(SERIALIZABLE_INCLUDING_VIEWS);

  return SortedMultisetTestSuiteBuilder.using(
          new ForwardingTestMultisetGenerator<E>(delegate) {
            @Override
            public SortedMultiset<E> create(Object... entries) {
              return SerializableTester.reserialize(((SortedMultiset<E>) super.create(entries)));
            }
          })
      .named(parentBuilder.getName() + " reserialized")
      .withFeatures(features)
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
项目:guava-mock    文件:SortedSetMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:guava-mock    文件:MultimapTestSuiteBuilder.java   
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();
  }
}
项目:guava-mock    文件:MultimapTestSuiteBuilder.java   
Set<Feature<?>> computeMultimapGetFeatures(Set<Feature<?>> multimapFeatures) {
  Set<Feature<?>> derivedFeatures = Helpers.copyToSet(multimapFeatures);
  for (Map.Entry<Feature<?>, Feature<?>> entry : GET_FEATURE_MAP.entries()) {
    if (derivedFeatures.contains(entry.getKey())) {
      derivedFeatures.add(entry.getValue());
    }
  }
  if (derivedFeatures.remove(MultimapFeature.VALUE_COLLECTIONS_SUPPORT_ITERATOR_REMOVE)) {
    derivedFeatures.add(CollectionFeature.SUPPORTS_ITERATOR_REMOVE);
  }
  if (!derivedFeatures.contains(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
    derivedFeatures.remove(CollectionFeature.SERIALIZABLE);
  }
  derivedFeatures.removeAll(GET_FEATURE_MAP.keySet());
  return derivedFeatures;
}
项目:guava-mock    文件:NavigableMapTestSuiteBuilder.java   
/**
 * Create a suite whose maps are descending views of other maps.
 */
private TestSuite createDescendingSuite(
    final FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>>
        parentBuilder) {
  final TestSortedMapGenerator<K, V> delegate =
      (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator();

  List<Feature<?>> features = new ArrayList<Feature<?>>();
  features.add(NoRecurse.DESCENDING);
  features.addAll(parentBuilder.getFeatures());

  return subSuiteUsing(new DescendingTestMapGenerator<K, V>(delegate))
      .named(parentBuilder.getName() + " descending")
      .withFeatures(features)
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
项目:guava-mock    文件:SortedMapTestSuiteBuilder.java   
/**
 * 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();
}
项目:googles-monorepo-demo    文件:SortedSetTestSuiteBuilder.java   
/**
 * 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();
}
项目:googles-monorepo-demo    文件:ListMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:googles-monorepo-demo    文件:SetMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:googles-monorepo-demo    文件:BiMapTestSuiteBuilder.java   
private static Set<Feature<?>> computeInverseFeatures(Set<Feature<?>> mapFeatures) {
  Set<Feature<?>> inverseFeatures = new HashSet<Feature<?>>(mapFeatures);

  boolean nullKeys = inverseFeatures.remove(MapFeature.ALLOWS_NULL_KEYS);
  boolean nullValues = inverseFeatures.remove(MapFeature.ALLOWS_NULL_VALUES);

  if (nullKeys) {
    inverseFeatures.add(MapFeature.ALLOWS_NULL_VALUES);
  }
  if (nullValues) {
    inverseFeatures.add(MapFeature.ALLOWS_NULL_KEYS);
  }

  inverseFeatures.add(NoRecurse.INVERSE);
  inverseFeatures.remove(CollectionFeature.KNOWN_ORDER);
  inverseFeatures.add(MapFeature.REJECTS_DUPLICATES_AT_CREATION);

  return inverseFeatures;
}
项目:googles-monorepo-demo    文件:SortedMultisetTestSuiteBuilder.java   
private TestSuite createReserializedSuite(SortedMultisetTestSuiteBuilder<E> parentBuilder) {
  final TestMultisetGenerator<E> delegate =
      (TestMultisetGenerator<E>) parentBuilder.getSubjectGenerator();

  Set<Feature<?>> features = new HashSet<Feature<?>>();
  features.addAll(parentBuilder.getFeatures());
  features.remove(SERIALIZABLE);
  features.remove(SERIALIZABLE_INCLUDING_VIEWS);

  return SortedMultisetTestSuiteBuilder.using(
          new ForwardingTestMultisetGenerator<E>(delegate) {
            @Override
            public SortedMultiset<E> create(Object... entries) {
              return SerializableTester.reserialize(((SortedMultiset<E>) super.create(entries)));
            }
          })
      .named(parentBuilder.getName() + " reserialized")
      .withFeatures(features)
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
项目:googles-monorepo-demo    文件:MultimapTestSuiteBuilder.java   
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();
  }
}
项目:googles-monorepo-demo    文件:MultimapTestSuiteBuilder.java   
Set<Feature<?>> computeMultimapGetFeatures(Set<Feature<?>> multimapFeatures) {
  Set<Feature<?>> derivedFeatures = Helpers.copyToSet(multimapFeatures);
  for (Map.Entry<Feature<?>, Feature<?>> entry : GET_FEATURE_MAP.entries()) {
    if (derivedFeatures.contains(entry.getKey())) {
      derivedFeatures.add(entry.getValue());
    }
  }
  if (derivedFeatures.remove(MultimapFeature.VALUE_COLLECTIONS_SUPPORT_ITERATOR_REMOVE)) {
    derivedFeatures.add(CollectionFeature.SUPPORTS_ITERATOR_REMOVE);
  }
  if (!derivedFeatures.contains(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
    derivedFeatures.remove(CollectionFeature.SERIALIZABLE);
  }
  derivedFeatures.removeAll(GET_FEATURE_MAP.keySet());
  return derivedFeatures;
}
项目:googles-monorepo-demo    文件:NavigableMapTestSuiteBuilder.java   
/**
 * Create a suite whose maps are descending views of other maps.
 */
private TestSuite createDescendingSuite(
    final FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>>
        parentBuilder) {
  final TestSortedMapGenerator<K, V> delegate =
      (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator();

  List<Feature<?>> features = new ArrayList<Feature<?>>();
  features.add(NoRecurse.DESCENDING);
  features.addAll(parentBuilder.getFeatures());

  return subSuiteUsing(new DescendingTestMapGenerator<K, V>(delegate))
      .named(parentBuilder.getName() + " descending")
      .withFeatures(features)
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
项目:googles-monorepo-demo    文件:SortedMapTestSuiteBuilder.java   
/**
 * 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();
}
项目:guava-libraries    文件:SortedSetTestSuiteBuilder.java   
/**
 * 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();
}
项目:guava-libraries    文件:MapTestSuiteBuilder.java   
private static Set<Feature<?>> computeKeySetFeatures(
    Set<Feature<?>> mapFeatures) {
  Set<Feature<?>> keySetFeatures =
      computeCommonDerivedCollectionFeatures(mapFeatures);

  // TODO(user): make this trigger only if the map is a submap
  // currently, the KeySetGenerator won't work properly for a subset of a keyset of a submap
  keySetFeatures.add(CollectionFeature.SUBSET_VIEW);
  if (mapFeatures.contains(MapFeature.ALLOWS_NULL_KEYS)) {
    keySetFeatures.add(CollectionFeature.ALLOWS_NULL_VALUES);
  } else if (mapFeatures.contains(MapFeature.ALLOWS_NULL_KEY_QUERIES)) {
    keySetFeatures.add(CollectionFeature.ALLOWS_NULL_QUERIES);
  }

  return keySetFeatures;
}
项目:guava-libraries    文件:ListMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:guava-libraries    文件:SetMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:guava-libraries    文件:BiMapTestSuiteBuilder.java   
private static Set<Feature<?>> computeInverseFeatures(Set<Feature<?>> mapFeatures) {
  Set<Feature<?>> inverseFeatures = new HashSet<Feature<?>>(mapFeatures);

  boolean nullKeys = inverseFeatures.remove(MapFeature.ALLOWS_NULL_KEYS);
  boolean nullValues = inverseFeatures.remove(MapFeature.ALLOWS_NULL_VALUES);

  if (nullKeys) {
    inverseFeatures.add(MapFeature.ALLOWS_NULL_VALUES);
  }
  if (nullValues) {
    inverseFeatures.add(MapFeature.ALLOWS_NULL_KEYS);
  }

  inverseFeatures.add(NoRecurse.INVERSE);
  inverseFeatures.remove(CollectionFeature.KNOWN_ORDER);
  inverseFeatures.add(MapFeature.REJECTS_DUPLICATES_AT_CREATION);

  return inverseFeatures;
}
项目:guava-libraries    文件:SortedMultisetTestSuiteBuilder.java   
private TestSuite createReserializedSuite(
    SortedMultisetTestSuiteBuilder<E> parentBuilder) {
  final TestMultisetGenerator<E> delegate =
      (TestMultisetGenerator<E>) parentBuilder.getSubjectGenerator();

  Set<Feature<?>> features = new HashSet<Feature<?>>();
  features.addAll(parentBuilder.getFeatures());
  features.remove(CollectionFeature.SERIALIZABLE);
  features.remove(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS);

  return SortedMultisetTestSuiteBuilder
      .using(new ForwardingTestMultisetGenerator<E>(delegate) {
        @Override
        public SortedMultiset<E> create(Object... entries) {
          return SerializableTester.reserialize(((SortedMultiset<E>) super.create(entries)));
        }
      })
      .named(parentBuilder.getName() + " reserialized")
      .withFeatures(features)
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
项目:guava-libraries    文件:SortedSetMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:guava-libraries    文件:MultimapTestSuiteBuilder.java   
Set<Feature<?>> computeMultimapGetFeatures(
    Set<Feature<?>> multimapFeatures) {
  Set<Feature<?>> derivedFeatures = Helpers.copyToSet(multimapFeatures);
  for (Map.Entry<Feature<?>, Feature<?>> entry : GET_FEATURE_MAP.entries()) {
    if (derivedFeatures.contains(entry.getKey())) {
      derivedFeatures.add(entry.getValue());
    }
  }
  if (derivedFeatures.remove(MultimapFeature.VALUE_COLLECTIONS_SUPPORT_ITERATOR_REMOVE)) {
    derivedFeatures.add(CollectionFeature.SUPPORTS_ITERATOR_REMOVE);
  }
  if (!derivedFeatures.contains(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
    derivedFeatures.remove(CollectionFeature.SERIALIZABLE);
  }
  derivedFeatures.removeAll(GET_FEATURE_MAP.keySet());
  return derivedFeatures;
}
项目:guava-libraries    文件:SortedMapTestSuiteBuilder.java   
/**
 * 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();
}
项目:guava    文件:SortedSetTestSuiteBuilder.java   
/**
 * 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();
}
项目:guava    文件:ListMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:guava    文件:SetMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:guava    文件:BiMapTestSuiteBuilder.java   
private static Set<Feature<?>> computeInverseFeatures(Set<Feature<?>> mapFeatures) {
  Set<Feature<?>> inverseFeatures = new HashSet<>(mapFeatures);

  boolean nullKeys = inverseFeatures.remove(MapFeature.ALLOWS_NULL_KEYS);
  boolean nullValues = inverseFeatures.remove(MapFeature.ALLOWS_NULL_VALUES);

  if (nullKeys) {
    inverseFeatures.add(MapFeature.ALLOWS_NULL_VALUES);
  }
  if (nullValues) {
    inverseFeatures.add(MapFeature.ALLOWS_NULL_KEYS);
  }

  inverseFeatures.add(NoRecurse.INVERSE);
  inverseFeatures.remove(CollectionFeature.KNOWN_ORDER);
  inverseFeatures.add(MapFeature.REJECTS_DUPLICATES_AT_CREATION);

  return inverseFeatures;
}
项目:guava    文件:SortedMultisetTestSuiteBuilder.java   
private TestSuite createReserializedSuite(SortedMultisetTestSuiteBuilder<E> parentBuilder) {
  final TestMultisetGenerator<E> delegate =
      (TestMultisetGenerator<E>) parentBuilder.getSubjectGenerator();

  Set<Feature<?>> features = new HashSet<>();
  features.addAll(parentBuilder.getFeatures());
  features.remove(SERIALIZABLE);
  features.remove(SERIALIZABLE_INCLUDING_VIEWS);

  return SortedMultisetTestSuiteBuilder.using(
          new ForwardingTestMultisetGenerator<E>(delegate) {
            @Override
            public SortedMultiset<E> create(Object... entries) {
              return SerializableTester.reserialize(((SortedMultiset<E>) super.create(entries)));
            }
          })
      .named(parentBuilder.getName() + " reserialized")
      .withFeatures(features)
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
项目:guava    文件:SortedSetMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:guava    文件:MultimapTestSuiteBuilder.java   
Set<Feature<?>> computeMultimapGetFeatures(Set<Feature<?>> multimapFeatures) {
  Set<Feature<?>> derivedFeatures = Helpers.copyToSet(multimapFeatures);
  for (Entry<Feature<?>, Feature<?>> entry : GET_FEATURE_MAP.entries()) {
    if (derivedFeatures.contains(entry.getKey())) {
      derivedFeatures.add(entry.getValue());
    }
  }
  if (derivedFeatures.remove(MultimapFeature.VALUE_COLLECTIONS_SUPPORT_ITERATOR_REMOVE)) {
    derivedFeatures.add(CollectionFeature.SUPPORTS_ITERATOR_REMOVE);
  }
  if (!derivedFeatures.contains(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
    derivedFeatures.remove(CollectionFeature.SERIALIZABLE);
  }
  derivedFeatures.removeAll(GET_FEATURE_MAP.keySet());
  return derivedFeatures;
}
项目:guava    文件:NavigableMapTestSuiteBuilder.java   
/** Create a suite whose maps are descending views of other maps. */
private TestSuite createDescendingSuite(
    final FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>>
        parentBuilder) {
  final TestSortedMapGenerator<K, V> delegate =
      (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator();

  List<Feature<?>> features = new ArrayList<>();
  features.add(NoRecurse.DESCENDING);
  features.addAll(parentBuilder.getFeatures());

  return subSuiteUsing(new DescendingTestMapGenerator<K, V>(delegate))
      .named(parentBuilder.getName() + " descending")
      .withFeatures(features)
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
项目:guava    文件:SortedMapTestSuiteBuilder.java   
/**
 * 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();
}
项目:guava    文件:SortedSetTestSuiteBuilder.java   
/**
 * 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();
}
项目:guava    文件:ListMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:guava    文件:SetMultimapTestSuiteBuilder.java   
@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();
  }
}