.named("unmodifiableRowSortedTable[TreeBasedTable].columnKeySet")
.withFeatures(COLLECTION_FEATURES_ORDER)
.createTestSuite());
suite.addTest(CollectionTestSuiteBuilder.using(
new TestStringCollectionGenerator() {
@Override protected Collection<String> create(String[] elements) {
List<Integer> rowKeys = Lists.newArrayList();
for (int i = 0; i < elements.length; i++) {
rowKeys.add(i);
}
Table<Integer, Character, String> table
= ArrayTable.create(rowKeys, ImmutableList.of('a'));
populateForValues(table, elements);
return table.values();
}
})
.named("ArrayTable.values")
.withFeatures(CollectionSize.ONE, CollectionSize.SEVERAL,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.KNOWN_ORDER)
.createTestSuite());
suite.addTest(CollectionTestSuiteBuilder.using(
new TestStringCollectionGenerator() {
@Override protected Collection<String> create(String[] elements) {
Table<Integer, Character, String> table = HashBasedTable.create();
table.put(1, 'a', "foo");
table.clear();
populateForValues(table, elements);
return table.values();
}
})
.named("HashBasedTable.values")
.withFeatures(COLLECTION_FEATURES_REMOVE)
.withFeatures(CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
.createTestSuite());
suite.addTest(CollectionTestSuiteBuilder.using(
new TestStringCollectionGenerator() {
@Override protected Collection<String> create(String[] elements) {
Table<Integer, Character, String> table = TreeBasedTable.create();
table.put(1, 'a', "foo");
table.clear();
populateForValues(table, elements);
return table.values();
}
})
.named("TreeBasedTable.values")
.withFeatures(COLLECTION_FEATURES_REMOVE_ORDER)
.withFeatures(CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
.createTestSuite());
final Function<String, String> removeFirstCharacter
= new Function<String, String>() {
@Override public String apply(String input) {
return input.substring(1);
}
};
suite.addTest(CollectionTestSuiteBuilder.using(
new TestStringCollectionGenerator() {
@Override protected Collection<String> create(String[] elements) {
Table<Integer, Character, String> table = HashBasedTable.create();
for (int i = 0; i < elements.length; i++) {
table.put(i, 'a', "x" + checkNotNull(elements[i]));
}
return Tables.transformValues(table, removeFirstCharacter).values();
}
})
.named("TransformValues.values")
.withFeatures(COLLECTION_FEATURES_REMOVE)
.withFeatures(CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
.createTestSuite());
suite.addTest(CollectionTestSuiteBuilder.using(
new TestStringCollectionGenerator() {
@Override protected Collection<String> create(String[] elements) {
Table<Integer, Character, String> table = HashBasedTable.create();
table.put(1, 'a', "foo");
table.clear();
populateForValues(table, elements);
return Tables.unmodifiableTable(table).values();
}
})
.named("unmodifiableTable[HashBasedTable].values")
.withFeatures(COLLECTION_FEATURES)
.createTestSuite());
suite.addTest(CollectionTestSuiteBuilder.using(
new TestStringCollectionGenerator() {
@Override protected Collection<String> create(String[] elements) {
RowSortedTable<Integer, Character, String> table = TreeBasedTable.create();
table.put(1, 'a', "foo");
table.clear();
populateForValues(table, elements);