@Test public void getFacetReturnsParsedValueKeysAndTheirCounts() { FacetGetter instance = new ListFacetGetter(new PropertyParserFactory().getParser(Gender.class)); Map<String, Set<Vertex>> values = Maps.newHashMap(); List<Vertex> vertices1 = newGraph() .withVertex(v -> v.withTimId("1")) .withVertex(v -> v.withTimId("2")) .build().traversal().V().toList(); List<Vertex> vertices2 = newGraph() .withVertex(v -> v.withTimId("3")) .build().traversal().V().toList(); values.put("\"MALE\"", Sets.newHashSet(vertices1)); values.put("\"FEMALE\"", Sets.newHashSet(vertices2)); Facet facet = instance.getFacet(FACET_NAME, values); assertThat(facet.getName(), equalTo(FACET_NAME)); assertThat(facet.getOptions(), containsInAnyOrder(new Facet.DefaultOption("MALE", 2), new Facet.DefaultOption("FEMALE", 1))); }
@Override public Facet getFacet(String facetName, Map<String, Set<Vertex>> values) { List<Facet.Option> options = values.entrySet().stream() .map(entry -> new Facet.DefaultOption(parseValue(entry.getKey()), entry.getValue().size())) .filter(facetOption -> facetOption.getName() != null) .collect(toList()); return new Facet(facetName, options, "LIST"); }
ListFacetGetter implements FacetGetter { @Override public Facet getFacet(String facetName, Map<String, Set<Vertex>> values) { List<Facet.Option> options = values.entrySet().stream() .map(entry -> new Facet.DefaultOption(parseValue(entry.getKey()), entry.getValue().size())) .filter(facetOption -> facetOption.getName() != null) .collect(toList()); return new Facet(facetName, options, "LIST"); } }
ListFacetGetter implements FacetGetter { @Override public Facet getFacet(String facetName, Map<String, Set<Vertex>> values) { List<Facet.Option> options = values.entrySet().stream() .map(entry -> new Facet.DefaultOption(parseValue(entry.getKey()), entry.getValue().size())) .filter(facetOption -> facetOption.getName() != null) .collect(toList()); return new Facet(facetName, options, "LIST"); } ListFacetGetter();  ListFacetGetter(PropertyParser parser); }
ListFacetGetter implements FacetGetter { @Override public Facet getFacet(String facetName, Map<String, Set<Vertex>> values) { List<Facet.Option> options = values.entrySet().stream() .map(entry -> new Facet.DefaultOption(parseValue(entry.getKey()), entry.getValue().size())) .filter(facetOption -> facetOption.getName() != null) .collect(toList()); return new Facet(facetName, options, "LIST"); } ListFacetGetter();  ListFacetGetter(PropertyParser parser); @Override Facet getFacet(String facetName, Map<String, Set<Vertex>> values); }
ListFacetGetter implements FacetGetter { @Override public Facet getFacet(String facetName, Map<String, Set<Vertex>> values) { List<Facet.Option> options = values.entrySet().stream() .map(entry -> new Facet.DefaultOption(parseValue(entry.getKey()), entry.getValue().size())) .filter(facetOption -> facetOption.getName() != null) .collect(toList()); return new Facet(facetName, options, "LIST"); } ListFacetGetter();  ListFacetGetter(PropertyParser parser); @Override Facet getFacet(String facetName, Map<String, Set<Vertex>> values);  }