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

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

Introduction

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

Prototype

CollectionFeature ALLOWS_NULL_VALUES

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

Click Source Link

Usage

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

public static TestSuite suite() {

    TestStringListGenerator listGenerator = new TestStringListGenerator() {

        @Override/* w w  w.j  av  a  2s . 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;
}