本文整理汇总了Java中com.google.common.collect.testing.features.Feature类的典型用法代码示例。如果您正苦于以下问题:Java Feature类的具体用法?Java Feature怎么用?Java Feature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Feature类属于com.google.common.collect.testing.features包,在下文中一共展示了Feature类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createSubsetSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
/**
* 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();
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:28,代码来源:SortedSetTestSuiteBuilder.java
示例2: computeMultimapAsMapGetTestSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
@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();
}
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:18,代码来源:ListMultimapTestSuiteBuilder.java
示例3: computeMultimapAsMapGetTestSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
@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();
}
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:18,代码来源:SetMultimapTestSuiteBuilder.java
示例4: computeInverseFeatures
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
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;
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:20,代码来源:BiMapTestSuiteBuilder.java
示例5: createReserializedSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
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();
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:22,代码来源:SortedMultisetTestSuiteBuilder.java
示例6: computeMultimapAsMapGetTestSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
@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();
}
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:19,代码来源:SortedSetMultimapTestSuiteBuilder.java
示例7: computeMultimapAsMapGetTestSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
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();
}
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:17,代码来源:MultimapTestSuiteBuilder.java
示例8: computeMultimapGetFeatures
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
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;
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:17,代码来源:MultimapTestSuiteBuilder.java
示例9: createDescendingSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
/**
* 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();
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:21,代码来源:NavigableMapTestSuiteBuilder.java
示例10: createSubmapSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
/**
* 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();
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:27,代码来源:SortedMapTestSuiteBuilder.java
示例11: createSubsetSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
/**
* 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();
}
开发者ID:sander120786,项目名称:guava-libraries,代码行数:25,代码来源:SortedSetTestSuiteBuilder.java
示例12: computeKeySetFeatures
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
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;
}
开发者ID:sander120786,项目名称:guava-libraries,代码行数:17,代码来源:MapTestSuiteBuilder.java
示例13: computeMultimapAsMapGetTestSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
@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();
}
}
开发者ID:sander120786,项目名称:guava-libraries,代码行数:17,代码来源:ListMultimapTestSuiteBuilder.java
示例14: computeMultimapAsMapGetTestSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
@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();
}
}
开发者ID:sander120786,项目名称:guava-libraries,代码行数:17,代码来源:SetMultimapTestSuiteBuilder.java
示例15: createReserializedSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
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();
}
开发者ID:sander120786,项目名称:guava-libraries,代码行数:23,代码来源:SortedMultisetTestSuiteBuilder.java
示例16: computeMultimapAsMapGetTestSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
@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();
}
}
开发者ID:sander120786,项目名称:guava-libraries,代码行数:18,代码来源:SortedSetMultimapTestSuiteBuilder.java
示例17: computeMultimapGetFeatures
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
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;
}
开发者ID:sander120786,项目名称:guava-libraries,代码行数:18,代码来源:MultimapTestSuiteBuilder.java
示例18: createSubmapSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
/**
* 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();
}
开发者ID:sander120786,项目名称:guava-libraries,代码行数:24,代码来源:SortedMapTestSuiteBuilder.java
示例19: createSubsetSuite
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
/**
* 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();
}
开发者ID:google,项目名称:guava,代码行数:27,代码来源:SortedSetTestSuiteBuilder.java
示例20: computeInverseFeatures
import com.google.common.collect.testing.features.Feature; //导入依赖的package包/类
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;
}
开发者ID:google,项目名称:guava,代码行数:20,代码来源:BiMapTestSuiteBuilder.java
注:本文中的com.google.common.collect.testing.features.Feature类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论