@Test public void getFacetInvokesTheFacetGetterToReturnTheFacet() { PropertyValueGetter propertyValueGetter = mock(PropertyValueGetter.class); FacetGetter facetGetter = mock(FacetGetter.class); Facet mockFacet = mock(Facet.class); given(facetGetter.getFacet(any(), any())).willReturn(mockFacet); FacetDescription instance = new FacetDescriptionImpl(FACET_NAME, PROPERTY_NAME, facetGetter, propertyValueGetter); Map<String, Set<Vertex>> facetCounts = new HashMap<>(); facetCounts.put(PROP_VAL, Sets.newHashSet()); Facet result = instance.getFacet(facetCounts); ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class); assertEquals(result, mockFacet); ArgumentCaptor<HashMap> captor1 = ArgumentCaptor.forClass(HashMap.class); verify(facetGetter, times(1)).getFacet(captor.capture(), captor1.capture()); assertThat(captor.getValue(), equalTo(FACET_NAME)); assertThat(captor1.getValue(), equalTo(facetCounts)); }
@Override public Facet getFacet(Map<String, Set<Vertex>> values) { return facetGetter.getFacet(facetName, values); }
AbstractFacetDescription implements FacetDescription { @Override public Facet getFacet(Map<String, Set<Vertex>> values) { return facetGetter.getFacet(facetName, values); } }
AbstractFacetDescription implements FacetDescription { @Override public Facet getFacet(Map<String, Set<Vertex>> values) { return facetGetter.getFacet(facetName, values); } AbstractFacetDescription(String facetName, String propertyName, FacetGetter facetGetter,
                                  PropertyValueGetter propertyValueGetter); }
AbstractFacetDescription implements FacetDescription { @Override public Facet getFacet(Map<String, Set<Vertex>> values) { return facetGetter.getFacet(facetName, values); } AbstractFacetDescription(String facetName, String propertyName, FacetGetter facetGetter,
                                  PropertyValueGetter propertyValueGetter); @Override String getName(); @Override Facet getFacet(Map<String, Set<Vertex>> values); @Override List<String> getValues(Vertex vertex); }
AbstractFacetDescription implements FacetDescription { @Override public Facet getFacet(Map<String, Set<Vertex>> values) { return facetGetter.getFacet(facetName, values); } AbstractFacetDescription(String facetName, String propertyName, FacetGetter facetGetter,
                                  PropertyValueGetter propertyValueGetter); @Override String getName(); @Override Facet getFacet(Map<String, Set<Vertex>> values); @Override List<String> getValues(Vertex vertex);  }