use of com.google.common.collect.Sets.newLinkedHashSet in project guava by google.
the class SetsTest method testsForFilterNoNulls.
// suite
@GwtIncompatible
private static Test testsForFilterNoNulls() {
TestSuite suite = new TestSuite();
suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
@Override
public Set<String> create(String[] elements) {
Set<String> unfiltered = Sets.newLinkedHashSet();
unfiltered.add("yyy");
unfiltered.addAll(ImmutableList.copyOf(elements));
unfiltered.add("zzz");
return Sets.filter(unfiltered, Collections2Test.LENGTH_1);
}
}).named("Sets.filter, no nulls").withFeatures(CollectionFeature.SUPPORTS_ADD, CollectionFeature.SUPPORTS_REMOVE, CollectionFeature.KNOWN_ORDER, CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
suite.addTest(NavigableSetTestSuiteBuilder.using(new TestStringSetGenerator() {
@Override
public NavigableSet<String> create(String[] elements) {
NavigableSet<String> unfiltered = Sets.newTreeSet();
unfiltered.add("yyy");
unfiltered.addAll(ImmutableList.copyOf(elements));
unfiltered.add("zzz");
return Sets.filter(unfiltered, Collections2Test.LENGTH_1);
}
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
}).named("Sets.filter[NavigableSet]").withFeatures(CollectionFeature.SUPPORTS_ADD, CollectionFeature.SUPPORTS_REMOVE, CollectionFeature.KNOWN_ORDER, CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_QUERIES).createTestSuite());
return suite;
}
Aggregations