ExactMatcherSearch { public MultiMap<Value, T, List<T>> search() { if (matcher.isNegate()) { if (map.containsKey(matcher.getValue())) { return MultiMap.merge(map.subMap(map.firstKey(), true, matcher.getValue(), false), map.subMap(matcher.getValue(), false, map.lastKey(), true)); } else { return map; } } else { return map.subMap(matcher.getValue(), true, matcher.getValue(), true); } } ExactMatcherSearch(final ExactMatcher matcher,
                              final MultiMap<Value, T, List<T>> map); MultiMap<Value, T, List<T>> search();  }
@Test public void testNullSearch() throws Exception { search = new ExactMatcherSearch<>( new ExactMatcher(KeyDefinition.newKeyDefinition().withId("value" ).build(), null ), map ); MultiMap<Value, Object, List<Object>> search1 = search.search(); assertEquals( "I am null", search1.get( new Value( null ) ).get( 0 ) ); }
@Test public void testNegatedNullSearch() throws Exception { search = new ExactMatcherSearch<>( new ExactMatcher( KeyDefinition.newKeyDefinition().withId( "value" ).build(), null, true ), map ); MultiMap<Value, Object, List<Object>> search1 = search.search(); assertEquals( "hello", search1.get( new Value( "helloKey" ) ).get( 0 ) ); }