### Question:
DefaultValueIndexer implements Indexer { @Override public Set<String> getIndexes(MetadataEntry entry) { Set<String> valueIndexes = new HashSet<>(); if (entry.getKey().equalsIgnoreCase(MetadataConstants.TAGS_KEY)) { valueIndexes.addAll(Arrays.asList(TAGS_SEPARATOR_PATTERN.split(entry.getValue()))); } else { valueIndexes.add(entry.getValue()); } Set<String> indexes = new HashSet<>(); for (String index : valueIndexes) { indexes.addAll(Arrays.asList(VALUE_SPLIT_PATTERN.split(index))); } indexes.addAll(valueIndexes); return addKeyValueIndexes(entry.getKey(), indexes); }  @Override Set<String> getIndexes(MetadataEntry entry); @Override SortInfo.SortOrder getSortOrder();  }### Answer:
@Test public void testSimpleProperty() { MetadataEntry entry = new MetadataEntry(NamespaceId.DEFAULT.app("a"), "key", "val"); Set<String> expected = new HashSet<>(); expected.add("val"); expected.add("key:val"); expected.add("properties:key"); Assert.assertEquals(expected, indexer.getIndexes(entry)); }
@Test public void testSingleSplitProperty() { MetadataEntry entry = new MetadataEntry(NamespaceId.DEFAULT.app("a"), "key", "foo bar"); Set<String> expected = new HashSet<>(); expected.add("foo bar"); expected.add("foo"); expected.add("bar"); expected.add("key:foo bar"); expected.add("key:foo"); expected.add("key:bar"); expected.add("properties:key"); Assert.assertEquals(expected, indexer.getIndexes(entry)); }
@Test public void testSingleSimpleTags() { MetadataEntry entry = new MetadataEntry(NamespaceId.DEFAULT.app("a"), MetadataConstants.TAGS_KEY, "tag"); Set<String> expected = new HashSet<>(); expected.add("tag"); expected.add(MetadataConstants.TAGS_KEY + ":tag"); Assert.assertEquals(expected, indexer.getIndexes(entry)); }
@Test public void testSingleSplitTags() { MetadataEntry entry = new MetadataEntry(NamespaceId.DEFAULT.app("a"), MetadataConstants.TAGS_KEY, "foo bar"); Set<String> expected = new HashSet<>(); expected.add("foo"); expected.add("bar"); expected.add(MetadataConstants.TAGS_KEY + ":foo"); expected.add(MetadataConstants.TAGS_KEY + ":bar"); Assert.assertEquals(expected, indexer.getIndexes(entry)); }
@Test public void testMultipleTags() { MetadataEntry entry = new MetadataEntry(NamespaceId.DEFAULT.app("a"), MetadataConstants.TAGS_KEY, "t1,t2,t3"); Set<String> expected = new HashSet<>(); expected.add("t1"); expected.add("t2"); expected.add("t3"); expected.add(MetadataConstants.TAGS_KEY + ":t1"); expected.add(MetadataConstants.TAGS_KEY + ":t2"); expected.add(MetadataConstants.TAGS_KEY + ":t3"); Assert.assertEquals(expected, indexer.getIndexes(entry)); }
@Test public void testMultipleSplitTags() { MetadataEntry entry = new MetadataEntry(NamespaceId.DEFAULT.app("a"), MetadataConstants.TAGS_KEY, "foo,bar baz"); Set<String> expected = new HashSet<>(); expected.add("foo"); expected.add("bar"); expected.add("baz"); expected.add(MetadataConstants.TAGS_KEY + ":foo"); expected.add(MetadataConstants.TAGS_KEY + ":bar"); expected.add(MetadataConstants.TAGS_KEY + ":baz"); Assert.assertEquals(expected, indexer.getIndexes(entry)); }