use of com.google.common.collect.testing.TestStringSortedMapGenerator in project guava by google.
the class ForwardingNavigableMapTest method suite.
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ForwardingNavigableMapTest.class);
suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
NavigableMap<String, String> map = new SafeTreeMap<>();
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), entry.getValue());
}
return new StandardImplForwardingNavigableMap<>(map);
}
}).named("ForwardingNavigableMap[SafeTreeMap] with no comparator and standard " + "implementations").withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, MapFeature.ALLOWS_NULL_VALUES, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, MapFeature.GENERAL_PURPOSE).suppressing(MapEntrySetTester.getSetValueMethod(), MapEntrySetTester.getSetValueWithNullValuesAbsentMethod(), MapEntrySetTester.getSetValueWithNullValuesPresentMethod()).createTestSuite());
// TODO(lowasser): add forwarding-to-ImmutableSortedMap test
return suite;
}
use of com.google.common.collect.testing.TestStringSortedMapGenerator in project guava by google.
the class MapsCollectionTest method transformSortedMapSuite.
static TestSuite transformSortedMapSuite() {
TestSuite suite = new TestSuite("TransformSortedMap");
suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
SortedMap<String, String> map = new NonNavigableSortedMap();
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), encode(entry.getValue()));
}
return Maps.transformValues(map, DECODE_FUNCTION);
}
}).named("Maps.transformValues[SortedMap, Function]").withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, MapFeature.SUPPORTS_REMOVE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE).createTestSuite());
suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
SortedMap<String, String> map = new NonNavigableSortedMap();
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), encode(entry.getValue()));
}
return Maps.transformEntries(map, DECODE_ENTRY_TRANSFORMER);
}
}).named("Maps.transformEntries[SortedMap, EntryTransformer]").withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, MapFeature.SUPPORTS_REMOVE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE).createTestSuite());
return suite;
}
use of com.google.common.collect.testing.TestStringSortedMapGenerator in project guava by google.
the class MapsCollectionTest method filterSortedMapSuite.
static TestSuite filterSortedMapSuite() {
TestSuite suite = new TestSuite("FilterSortedMap");
suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
SortedMap<String, String> map = new NonNavigableSortedMap();
putEntries(map, entries);
map.putAll(ENTRIES_TO_FILTER);
return Maps.filterKeys(map, FILTER_KEYS);
}
}).named("Maps.filterKeys[SortedMap, Predicate]").withFeatures(MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionSize.ANY).createTestSuite());
suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
SortedMap<String, String> map = new NonNavigableSortedMap();
putEntries(map, entries);
map.putAll(ENTRIES_TO_FILTER);
return Maps.filterValues(map, FILTER_VALUES);
}
}).named("Maps.filterValues[SortedMap, Predicate]").withFeatures(MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionSize.ANY).createTestSuite());
suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
SortedMap<String, String> map = new NonNavigableSortedMap();
putEntries(map, entries);
map.putAll(ENTRIES_TO_FILTER);
return Maps.filterEntries(map, FILTER_ENTRIES);
}
}).named("Maps.filterEntries[SortedMap, Predicate]").withFeatures(MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionSize.ANY).createTestSuite());
return suite;
}
use of com.google.common.collect.testing.TestStringSortedMapGenerator in project guava by google.
the class TreeBasedTableTest method suite.
// suite
@GwtIncompatible
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(TreeBasedTableTest.class);
suite.addTestSuite(TreeRowTest.class);
suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
for (Entry<String, String> entry : entries) {
table.put("b", entry.getKey(), entry.getValue());
}
return table.row("b");
}
}).withFeatures(MapFeature.GENERAL_PURPOSE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionSize.ANY).named("RowMapTestSuite").createTestSuite());
return suite;
}
use of com.google.common.collect.testing.TestStringSortedMapGenerator in project guava by google.
the class MapsCollectionTest method filterNavigableMapSuite.
static TestSuite filterNavigableMapSuite() {
TestSuite suite = new TestSuite("FilterNavigableMap");
suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override
protected NavigableMap<String, String> create(Entry<String, String>[] entries) {
NavigableMap<String, String> map = new SafeTreeMap<>();
putEntries(map, entries);
map.put("banana", "toast");
map.put("eggplant", "spam");
return Maps.filterKeys(map, FILTER_KEYS);
}
}).named("Maps.filterKeys[NavigableMap, Predicate]").withFeatures(MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionSize.ANY).createTestSuite());
suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override
protected NavigableMap<String, String> create(Entry<String, String>[] entries) {
NavigableMap<String, String> map = new SafeTreeMap<>();
putEntries(map, entries);
map.put("banana", "toast");
map.put("eggplant", "spam");
return Maps.filterValues(map, FILTER_VALUES);
}
}).named("Maps.filterValues[NavigableMap, Predicate]").withFeatures(MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionSize.ANY).createTestSuite());
suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override
protected NavigableMap<String, String> create(Entry<String, String>[] entries) {
NavigableMap<String, String> map = new SafeTreeMap<>();
putEntries(map, entries);
map.put("banana", "toast");
map.put("eggplant", "spam");
return Maps.filterEntries(map, FILTER_ENTRIES);
}
}).named("Maps.filterEntries[NavigableMap, Predicate]").withFeatures(MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionSize.ANY).createTestSuite());
return suite;
}
Aggregations