本文整理汇总了Java中com.google.common.collect.testing.features.SetFeature类的典型用法代码示例。如果您正苦于以下问题:Java SetFeature类的具体用法?Java SetFeature怎么用?Java SetFeature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SetFeature类属于com.google.common.collect.testing.features包,在下文中一共展示了SetFeature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testsForCheckedNavigableSet
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForCheckedNavigableSet() {
return SortedSetTestSuiteBuilder.using(
new TestStringSortedSetGenerator() {
@Override
public NavigableSet<String> create(String[] elements) {
NavigableSet<String> innerSet = new TreeSet<String>();
Collections.addAll(innerSet, elements);
return Collections.checkedNavigableSet(innerSet, String.class);
}
})
.named("checkedNavigableSet/TreeSet, natural")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.KNOWN_ORDER,
CollectionFeature.SERIALIZABLE,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionFeature.RESTRICTS_ELEMENTS,
CollectionSize.ANY)
.suppressing(suppressForCheckedNavigableSet())
.createTestSuite();
}
示例2: testsForHashSet
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForHashSet() {
return SetTestSuiteBuilder.using(
new TestStringSetGenerator() {
@Override
public Set<String> create(String[] elements) {
return new HashSet<String>(MinimalCollection.of(elements));
}
})
.named("HashSet")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionSize.ANY)
.suppressing(suppressForHashSet())
.createTestSuite();
}
示例3: testsForLinkedHashSet
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForLinkedHashSet() {
return SetTestSuiteBuilder.using(
new TestStringSetGenerator() {
@Override
public Set<String> create(String[] elements) {
return new LinkedHashSet<String>(MinimalCollection.of(elements));
}
})
.named("LinkedHashSet")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.KNOWN_ORDER,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionSize.ANY)
.suppressing(suppressForLinkedHashSet())
.createTestSuite();
}
示例4: testsForEnumSet
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForEnumSet() {
return SetTestSuiteBuilder.using(
new TestEnumSetGenerator() {
@Override
public Set<AnEnum> create(AnEnum[] elements) {
return (elements.length == 0)
? EnumSet.noneOf(AnEnum.class)
: EnumSet.copyOf(MinimalCollection.of(elements));
}
})
.named("EnumSet")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.KNOWN_ORDER,
CollectionFeature.RESTRICTS_ELEMENTS,
CollectionSize.ANY)
.suppressing(suppressForEnumSet())
.createTestSuite();
}
示例5: testsForSynchronizedNavigableSet
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
/**
* Tests regular NavigableSet behavior of synchronizedNavigableSet(treeSet);
* does not test the fact that it's synchronized.
*/
public Test testsForSynchronizedNavigableSet() {
return NavigableSetTestSuiteBuilder.using(
new TestStringSortedSetGenerator() {
@Override
public SortedSet<String> create(String[] elements) {
NavigableSet<String> delegate = new TreeSet<>(MinimalCollection.of(elements));
return Collections.synchronizedNavigableSet(delegate);
}
})
.named("synchronizedNavigableSet/TreeSet, natural")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.KNOWN_ORDER,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionSize.ANY)
.suppressing(suppressForSynchronizedNavigableSet())
.createTestSuite();
}
示例6: testsForTreeSetNatural
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForTreeSetNatural() {
return NavigableSetTestSuiteBuilder.using(
new TestStringSortedSetGenerator() {
@Override
public SortedSet<String> create(String[] elements) {
return new TreeSet<String>(MinimalCollection.of(elements));
}
})
.named("TreeSet, natural")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.KNOWN_ORDER,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionSize.ANY)
.suppressing(suppressForTreeSetNatural())
.createTestSuite();
}
示例7: testsForTreeSetWithComparator
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForTreeSetWithComparator() {
return NavigableSetTestSuiteBuilder.using(
new TestStringSortedSetGenerator() {
@Override
public SortedSet<String> create(String[] elements) {
SortedSet<String> set = new TreeSet<String>(arbitraryNullFriendlyComparator());
Collections.addAll(set, elements);
return set;
}
})
.named("TreeSet, with comparator")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.KNOWN_ORDER,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionSize.ANY)
.suppressing(suppressForTreeSetWithComparator())
.createTestSuite();
}
示例8: testsForCheckedSet
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForCheckedSet() {
return SetTestSuiteBuilder.using(
new TestStringSetGenerator() {
@Override
public Set<String> create(String[] elements) {
Set<String> innerSet = new HashSet<String>();
Collections.addAll(innerSet, elements);
return Collections.checkedSet(innerSet, String.class);
}
})
.named("checkedSet/HashSet")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.RESTRICTS_ELEMENTS,
CollectionSize.ANY)
.suppressing(suppressForCheckedSet())
.createTestSuite();
}
示例9: testsForCheckedSortedSet
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForCheckedSortedSet() {
return SortedSetTestSuiteBuilder.using(
new TestStringSortedSetGenerator() {
@Override
public SortedSet<String> create(String[] elements) {
SortedSet<String> innerSet = new TreeSet<String>();
Collections.addAll(innerSet, elements);
return Collections.checkedSortedSet(innerSet, String.class);
}
})
.named("checkedSortedSet/TreeSet, natural")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.KNOWN_ORDER,
CollectionFeature.SERIALIZABLE,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionFeature.RESTRICTS_ELEMENTS,
CollectionSize.ANY)
.suppressing(suppressForCheckedSortedSet())
.createTestSuite();
}
示例10: testsForBadlyCollidingHashSet
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForBadlyCollidingHashSet() {
return SetTestSuiteBuilder.using(
new TestCollidingSetGenerator() {
@Override
public Set<Object> create(Object... elements) {
return new HashSet<Object>(MinimalCollection.of(elements));
}
})
.named("badly colliding HashSet")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionSize.SEVERAL)
.suppressing(suppressForHashSet())
.createTestSuite();
}
示例11: testsForConcurrentSkipListSetNatural
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForConcurrentSkipListSetNatural() {
return SetTestSuiteBuilder.using(
new TestStringSortedSetGenerator() {
@Override
public SortedSet<String> create(String[] elements) {
return new ConcurrentSkipListSet<String>(MinimalCollection.of(elements));
}
})
.named("ConcurrentSkipListSet, natural")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.KNOWN_ORDER,
CollectionSize.ANY)
.suppressing(suppressForConcurrentSkipListSetNatural())
.createTestSuite();
}
示例12: testsForConcurrentSkipListSetWithComparator
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForConcurrentSkipListSetWithComparator() {
return SetTestSuiteBuilder.using(
new TestStringSortedSetGenerator() {
@Override
public SortedSet<String> create(String[] elements) {
SortedSet<String> set =
new ConcurrentSkipListSet<String>(arbitraryNullFriendlyComparator());
Collections.addAll(set, elements);
return set;
}
})
.named("ConcurrentSkipListSet, with comparator")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.KNOWN_ORDER,
CollectionSize.ANY)
.suppressing(suppressForConcurrentSkipListSetWithComparator())
.createTestSuite();
}
示例13: testsForHashSet
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForHashSet() {
return SetTestSuiteBuilder
.using(new TestStringSetGenerator() {
@Override public Set<String> create(String[] elements) {
return new HashSet<String>(MinimalCollection.of(elements));
}
})
.named("HashSet")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionSize.ANY)
.suppressing(suppressForHashSet())
.createTestSuite();
}
示例14: testsForLinkedHashSet
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForLinkedHashSet() {
return SetTestSuiteBuilder
.using(new TestStringSetGenerator() {
@Override public Set<String> create(String[] elements) {
return new LinkedHashSet<String>(MinimalCollection.of(elements));
}
})
.named("LinkedHashSet")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.KNOWN_ORDER,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionSize.ANY)
.suppressing(suppressForLinkedHashSet())
.createTestSuite();
}
示例15: testsForEnumSet
import com.google.common.collect.testing.features.SetFeature; //导入依赖的package包/类
public Test testsForEnumSet() {
return SetTestSuiteBuilder
.using(new TestEnumSetGenerator() {
@Override public Set<AnEnum> create(AnEnum[] elements) {
return (elements.length == 0)
? EnumSet.noneOf(AnEnum.class)
: EnumSet.copyOf(MinimalCollection.of(elements));
}
})
.named("EnumSet")
.withFeatures(
SetFeature.GENERAL_PURPOSE,
CollectionFeature.SERIALIZABLE,
CollectionFeature.KNOWN_ORDER,
CollectionFeature.RESTRICTS_ELEMENTS,
CollectionSize.ANY)
.suppressing(suppressForEnumSet())
.createTestSuite();
}