public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ForwardingSortedMapTest.class);
suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override protected SortedMap<String, String> create(
Entry<String, String>[] entries) {
SortedMap<String, String> map = new SafeTreeMap<String, String>();
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), entry.getValue());
}
return new StandardImplForwardingSortedMap<String, String>(map);
}
}).named("ForwardingSortedMap[SafeTreeMap] with no comparator and standard "
+ "implementations").withFeatures(CollectionSize.ANY,
CollectionFeature.KNOWN_ORDER, MapFeature.ALLOWS_NULL_VALUES,
MapFeature.GENERAL_PURPOSE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
.createTestSuite());
suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
private final Comparator<String> comparator = NullsBeforeTwo.INSTANCE;
@Override protected SortedMap<String, String> create(
Entry<String, String>[] entries) {
SortedMap<String, String> map =
new SafeTreeMap<String, String>(comparator);
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), entry.getValue());
}
return new StandardImplForwardingSortedMap<String, String>(map);
}
}).named("ForwardingSortedMap[SafeTreeMap] with natural comparator and "
+ "standard implementations").withFeatures(CollectionSize.ANY,
CollectionFeature.KNOWN_ORDER, MapFeature.ALLOWS_NULL_VALUES,
MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_ANY_NULL_QUERIES,
MapFeature.GENERAL_PURPOSE,
CollectionFeature.SUPPORTS_ITERATOR_REMOVE).createTestSuite());
suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
@Override protected SortedMap<String, String> create(
Entry<String, String>[] entries) {
ImmutableSortedMap.Builder<String, String> builder =
ImmutableSortedMap.naturalOrder();
for (Entry<String, String> entry : entries) {