use of nl.knaw.huygens.timbuctoo.search.description.FacetDescription in project timbuctoo by HuygensING.
the class FacetDescriptionFactoryTest method createChangeRangeFacetDescriptionCreatesAChangeRangeFacetDescriptionIfTheTypeIsChange.
@Test
public void createChangeRangeFacetDescriptionCreatesAChangeRangeFacetDescriptionIfTheTypeIsChange() {
FacetDescription facetDescription = instance.createChangeRangeFacetDescription("facetName", "propertyName");
assertThat(facetDescription, is(instanceOf(ChangeRangeFacetDescription.class)));
}
use of nl.knaw.huygens.timbuctoo.search.description.FacetDescription in project timbuctoo by HuygensING.
the class AbstractFacetDescriptionTest method getFacetInvokesTheFacetGetterToReturnTheFacet.
@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));
}
use of nl.knaw.huygens.timbuctoo.search.description.FacetDescription in project timbuctoo by HuygensING.
the class AbstractFacetDescriptionTest method getNameReturnsTheFacetName.
@Test
public void getNameReturnsTheFacetName() {
PropertyValueGetter propertyValueGetter = mock(PropertyValueGetter.class);
FacetGetter facetGetter = mock(FacetGetter.class);
FacetDescription instance = new FacetDescriptionImpl(FACET_NAME, PROPERTY_NAME, facetGetter, propertyValueGetter);
assertThat(instance.getName(), equalTo(FACET_NAME));
}
use of nl.knaw.huygens.timbuctoo.search.description.FacetDescription in project timbuctoo by HuygensING.
the class AbstractFacetDescriptionTest method getValuesInvokesThePropertyValueGetterToReturnThePropertyValues.
@Test
public void getValuesInvokesThePropertyValueGetterToReturnThePropertyValues() {
PropertyValueGetter propertyValueGetter = mock(PropertyValueGetter.class);
FacetGetter facetGetter = mock(FacetGetter.class);
List<String> mockValues = mock(List.class);
Vertex vertex = mock(Vertex.class);
given(propertyValueGetter.getValues(any(), any())).willReturn(mockValues);
FacetDescription instance = new FacetDescriptionImpl(FACET_NAME, PROPERTY_NAME, facetGetter, propertyValueGetter);
List<String> result = instance.getValues(vertex);
assertEquals(result, mockValues);
ArgumentCaptor<Vertex> captor = ArgumentCaptor.forClass(Vertex.class);
ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
verify(propertyValueGetter, times(1)).getValues(captor.capture(), captor1.capture());
assertThat(captor.getValue(), equalTo(vertex));
assertThat(captor1.getValue(), equalTo(PROPERTY_NAME));
}
use of nl.knaw.huygens.timbuctoo.search.description.FacetDescription in project timbuctoo by HuygensING.
the class FacetDescriptionFactoryTest method createMultiValueFacetDescriptionWithARelationCreatesADerivedMultiValueFacetDescription.
@Test
public void createMultiValueFacetDescriptionWithARelationCreatesADerivedMultiValueFacetDescription() {
FacetDescription description = instance.createMultiValueListFacetDescription("facetName", "propertyName", "relationName");
assertThat(description, is(instanceOf(RelatedMultiValueListFacetDescription.class)));
}
Aggregations