use of nl.knaw.huygens.timbuctoo.search.description.PropertyParser in project timbuctoo by HuygensING.
the class FacetDescriptionFactoryTest method createListFacetDescriptionWithARelationCreatesADerivedListFacetDescription.
@Test
public void createListFacetDescriptionWithARelationCreatesADerivedListFacetDescription() {
PropertyParser parser = mock(PropertyParser.class);
FacetDescription description = instance.createListFacetDescription("facetName", parser, "propertyName", "relation");
assertThat(description, is(instanceOf(RelatedListFacetDescription.class)));
}
use of nl.knaw.huygens.timbuctoo.search.description.PropertyParser in project timbuctoo by HuygensING.
the class LocalPropertyDescriptorTest method getReturnsValueFromParserParseIfTheVertexDoesContainTheProperty.
@Test
public void getReturnsValueFromParserParseIfTheVertexDoesContainTheProperty() {
String propertyName = "propName";
String expectedValue = "a string";
PropertyParser parser = mock(PropertyParser.class);
given(parser.parse(anyString())).willReturn(expectedValue);
Vertex vertex = vertex().withProperty(propertyName, "a string 2").build();
LocalPropertyDescriptor instance = new LocalPropertyDescriptor(propertyName, parser);
String value = instance.get(vertex);
assertThat(value, is(equalTo(expectedValue)));
verify(parser).parse(anyString());
}
use of nl.knaw.huygens.timbuctoo.search.description.PropertyParser in project timbuctoo by HuygensING.
the class LocalPropertyDescriptorTest method getReturnsTheValueWithAPrefixAndAPostfixIfTheyAreConfigured.
@Test
public void getReturnsTheValueWithAPrefixAndAPostfixIfTheyAreConfigured() {
String propertyName = "propName";
String expectedValue = "a string";
String prefix = "[";
String postfix = "]";
PropertyParser parser = mock(PropertyParser.class);
given(parser.parse(anyString())).willReturn(expectedValue);
Vertex vertex = vertex().withProperty(propertyName, "a string 2").build();
LocalPropertyDescriptor instance = new LocalPropertyDescriptor(propertyName, parser, prefix, postfix);
String value = instance.get(vertex);
assertThat(value, allOf(startsWith(prefix), endsWith(postfix)));
verify(parser).parse(anyString());
}
use of nl.knaw.huygens.timbuctoo.search.description.PropertyParser in project timbuctoo by HuygensING.
the class LocalPropertyDescriptorTest method getReturnsNullIfTheParserReturnsNull.
@Test
public void getReturnsNullIfTheParserReturnsNull() {
String propertyName = "propName";
String prefix = "[";
String postfix = "]";
PropertyParser parser = mock(PropertyParser.class);
given(parser.parse(anyString())).willReturn(null);
Vertex vertex = vertex().withProperty(propertyName, "a string 2").build();
LocalPropertyDescriptor instance = new LocalPropertyDescriptor(propertyName, parser, prefix, postfix);
String value = instance.get(vertex);
assertThat(value, is(nullValue()));
}
use of nl.knaw.huygens.timbuctoo.search.description.PropertyParser in project timbuctoo by HuygensING.
the class PropertyDescriptorFactoryTest method getLocalWithPrefixAndPostfixReturnsLocalPropertyDescriptor.
@Test
public void getLocalWithPrefixAndPostfixReturnsLocalPropertyDescriptor() {
PropertyParser parser = mock(PropertyParser.class);
PropertyDescriptor descriptor = instance.getLocal("propertyName", parser, "prefix", "postfix");
assertThat(descriptor, is(instanceOf(LocalPropertyDescriptor.class)));
}
Aggregations