List of usage examples for com.google.common.collect.testing.features CollectionFeature SUPPORTS_ADD
CollectionFeature SUPPORTS_ADD
To view the source code for com.google.common.collect.testing.features CollectionFeature SUPPORTS_ADD.
Click Source Link
From source file:org.java0.collection.ArraySetSuite.java
public static TestSuite suite() { TestStringSetGenerator generator = new TestStringSetGenerator() { @Override//from w ww .ja v a 2s.c o m protected Set<String> create(String[] elements) { Set<String> set = new ArraySet<String>(); set.addAll(Arrays.asList(elements)); return set; } }; TestSuite suite = SetTestSuiteBuilder.using(generator).named("ArraySetTest") .withFeatures(SetFeature.GENERAL_PURPOSE, CollectionFeature.SUPPORTS_ADD, CollectionFeature.SUPPORTS_REMOVE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionFeature.GENERAL_PURPOSE, CollectionSize.ANY) .createTestSuite(); return suite; }
From source file:org.java0.collection.ArrayBufferSuite.java
public static TestSuite suite() { TestStringListGenerator listGenerator = new TestStringListGenerator() { @Override//from w ww .j av a2s. c o m protected List<String> create(String[] elements) { List<String> buffer = new ArrayBuffer<String>(1000); buffer.addAll(Arrays.asList(elements)); return buffer; } }; TestStringQueueGenerator queueGenerator = new TestStringQueueGenerator() { @Override protected Queue<String> create(String[] elements) { Queue<String> buffer = new ArrayBuffer<String>(1000); buffer.addAll(Arrays.asList(elements)); return buffer; } }; TestSuite listSuite = ListTestSuiteBuilder.using(listGenerator).named("ArrayBufferSuite") .withFeatures(CollectionFeature.ALLOWS_NULL_VALUES, ListFeature.SUPPORTS_SET, CollectionFeature.SUPPORTS_ADD, CollectionFeature.SUPPORTS_REMOVE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionSize.ANY) .createTestSuite(); TestSuite queueSuite = QueueTestSuiteBuilder.using(queueGenerator).named("ArrayBufferSuite") .withFeatures(CollectionFeature.ALLOWS_NULL_VALUES, CollectionFeature.SUPPORTS_ADD, CollectionFeature.SUPPORTS_REMOVE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionSize.ANY) .createTestSuite(); for (int i = 0; i < queueSuite.testCount(); ++i) { listSuite.addTest(queueSuite.testAt(i)); } return listSuite; }
From source file:org.java0.collection.HashRowSetSuite.java
public static TestSuite suite() { TestSetGenerator<Tuple> generator = new TestSetGenerator<Tuple>() { @Override//from w w w. j av a 2 s . c o m public SampleElements<Tuple> samples() { return new SampleElements<Tuple>(new FourTuple<>("hello", 1, true, "world"), new FourTuple<>("hello1", 1, true, "world"), new FourTuple<>("hello2", 1, true, "world"), new FourTuple<>("hello", 1, true, "world1"), new FourTuple<>("hello", 1, true, "world2")); } @Override public Tuple[] createArray(int length) { return new Tuple[length]; } @Override public Iterable<Tuple> order(List<Tuple> insertionOrder) { return insertionOrder; } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Set<Tuple> create(Object... elements) { Set<Tuple> set = new HashRowSet(); set.addAll((Collection) Arrays.asList(elements)); return set; } }; TestSuite suite = SetTestSuiteBuilder.using(generator).named("HashRowSetSuite") .withFeatures(SetFeature.GENERAL_PURPOSE, CollectionFeature.SUPPORTS_ADD, CollectionFeature.SUPPORTS_REMOVE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionFeature.GENERAL_PURPOSE, CollectionSize.ANY) .createTestSuite(); return suite; }