FieldType fieldType = mock(FieldType.class);
when(fieldType.getValueType()).thenReturn(valueType);
HierarchicalFacetPrefixFormatter formatter = new HierarchicalFacetPrefixFormatter();
List<String> result = formatter.format(Lists.newArrayList(
new IndexValue(null, fieldType, "foo/bar"),
new IndexValue(null, fieldType, "bar/foo")), null);
assertEquals(4, result.size());
assertEquals("0/foo", result.get(0));
assertEquals("1/foo/bar", result.get(1));
assertEquals("0/bar", result.get(2));