use of com.google.common.collect.testing.TestStringMapGenerator in project guava by hceylan.
the class TreeBasedTableTest method suite.
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(TreeBasedTableTest.class);
suite.addTestSuite(TreeRowTest.class);
suite.addTest(MapTestSuiteBuilder.using(new TestStringMapGenerator() {
@Override
protected Map<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, CollectionSize.ANY).named("RowMapTestSuite").createTestSuite());
return suite;
}
use of com.google.common.collect.testing.TestStringMapGenerator in project guava by hceylan.
the class ForwardingNavigableMapTest method suite.
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ForwardingNavigableMapTest.class);
suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringMapGenerator() {
@Override
protected Map<String, String> create(Entry<String, String>[] entries) {
NavigableMap<String, String> map = new SafeTreeMap<String, String>();
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), entry.getValue());
}
return new StandardImplForwardingNavigableMap<String, String>(map);
}
@Override
public Iterable<Entry<String, String>> order(List<Entry<String, String>> insertionOrder) {
return sort(insertionOrder);
}
}).named("ForwardingNavigableMap[SafeTreeMap] with no comparator and standard " + "implementations").withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE).createTestSuite());
// TODO(user): add forwarding-to-ImmutableSortedMap test
return suite;
}
use of com.google.common.collect.testing.TestStringMapGenerator in project guava by google.
the class ForwardingMapTest method suite.
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ForwardingMapTest.class);
suite.addTest(MapTestSuiteBuilder.using(new TestStringMapGenerator() {
@Override
protected Map<String, String> create(Entry<String, String>[] entries) {
Map<String, String> map = Maps.newLinkedHashMap();
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), entry.getValue());
}
return new StandardImplForwardingMap<String, String>(map);
}
}).named("ForwardingMap[LinkedHashMap] with standard implementations").withFeatures(CollectionSize.ANY, MapFeature.ALLOWS_NULL_VALUES, MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_ANY_NULL_QUERIES, MapFeature.GENERAL_PURPOSE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionFeature.KNOWN_ORDER).createTestSuite());
suite.addTest(MapTestSuiteBuilder.using(new TestStringMapGenerator() {
@Override
protected Map<String, String> create(Entry<String, String>[] entries) {
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
for (Entry<String, String> entry : entries) {
builder.put(entry.getKey(), entry.getValue());
}
return new StandardImplForwardingMap<String, String>(builder.build());
}
}).named("ForwardingMap[ImmutableMap] with standard implementations").withFeatures(CollectionSize.ANY, MapFeature.REJECTS_DUPLICATES_AT_CREATION, MapFeature.ALLOWS_ANY_NULL_QUERIES, CollectionFeature.KNOWN_ORDER).createTestSuite());
return suite;
}
Aggregations