Example usage for com.google.common.collect.testing.features CollectionFeature SUPPORTS_REMOVE

List of usage examples for com.google.common.collect.testing.features CollectionFeature SUPPORTS_REMOVE

Introduction

In this page you can find the example usage for com.google.common.collect.testing.features CollectionFeature SUPPORTS_REMOVE.

Prototype

CollectionFeature SUPPORTS_REMOVE

To view the source code for com.google.common.collect.testing.features CollectionFeature SUPPORTS_REMOVE.

Click Source Link

Usage

From source file:org.java0.collection.ArraySetSuite.java

public static TestSuite suite() {

    TestStringSetGenerator generator = new TestStringSetGenerator() {

        @Override//from w w  w  .  java2  s.  com
        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 . ja  va 2  s  .  co 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/* w  w w . ja  va 2  s  .c om*/
        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;
}