Example usage for com.google.common.collect.testing.features MapFeature ALLOWS_NULL_ENTRY_QUERIES

List of usage examples for com.google.common.collect.testing.features MapFeature ALLOWS_NULL_ENTRY_QUERIES

Introduction

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

Prototype

MapFeature ALLOWS_NULL_ENTRY_QUERIES

To view the source code for com.google.common.collect.testing.features MapFeature ALLOWS_NULL_ENTRY_QUERIES.

Click Source Link

Document

The map does not throw NullPointerException on calls such as entrySet().contains(null) or entrySet().remove(null)

Usage

From source file:com.github.benmanes.caffeine.cache.MapTestFactory.java

/**
 * Returns a test suite./* w  ww.  j  a v  a  2  s  . c om*/
 *
 * @param name the name of the cache type under test
 * @param supplier the cache as a map
 * @return a suite of tests
 */
protected static Test suite(String name, Supplier<Map<String, String>> supplier) {
    return MapTestSuiteBuilder.using(new TestStringMapGenerator() {
        @Override
        protected Map<String, String> create(Entry<String, String>[] entries) {
            Map<String, String> map = supplier.get();
            for (Entry<String, String> entry : entries) {
                map.put(entry.getKey(), entry.getValue());
            }
            return map;
        }
    }).named(name).withFeatures(MapFeature.GENERAL_PURPOSE, MapFeature.ALLOWS_NULL_ENTRY_QUERIES,
            CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionSize.ANY).createTestSuite();
}

From source file:com.koloboke.collect.testing.map.HyperCharShortMapTestSuiteBuilder.java

private MapTestSuiteBuilder<Character, Short> forEachTestSuiteBuilder(
        MapTestSuiteBuilder<Character, Short> builder) {
    return builder.suppressing(suppressing).withFeatures(MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION)
            .withFeatures(MapFeature.ALLOWS_NULL_ENTRY_QUERIES).withFeatures(CollectionSize.ANY)
            .withFeatures(specialFeatures);
}