use of nl.knaw.huygens.timbuctoo.search.description.PropertyDescriptor in project timbuctoo by HuygensING.
the class AppenderPropertyDescriptorTest method getReturnAppendsTheValuesOfThePropertyDescriptorsSeparatedByTheSeparator.
@Test
public void getReturnAppendsTheValuesOfThePropertyDescriptorsSeparatedByTheSeparator() {
PropertyDescriptor propertyDescriptor1 = propertyDescriptorThatReturns("value1");
PropertyDescriptor propertyDescriptor2 = propertyDescriptorThatReturns("value2");
String separator = " ";
AppenderPropertyDescriptor instance = new AppenderPropertyDescriptor(propertyDescriptor1, propertyDescriptor2, separator);
Vertex vertex = vertex().build();
String value = instance.get(vertex);
assertThat(value, is("value1 value2"));
}
use of nl.knaw.huygens.timbuctoo.search.description.PropertyDescriptor in project timbuctoo by HuygensING.
the class AppenderPropertyDescriptorTest method getReturnsOnlyTheValueOfTheSecondDescriptorIfTheFirstReturnsNull.
@Test
public void getReturnsOnlyTheValueOfTheSecondDescriptorIfTheFirstReturnsNull() {
PropertyDescriptor propertyDescriptor1 = propertyDescriptorThatReturns(null);
PropertyDescriptor propertyDescriptor2 = propertyDescriptorThatReturns("value2");
String separator = " ";
AppenderPropertyDescriptor instance = new AppenderPropertyDescriptor(propertyDescriptor1, propertyDescriptor2, separator);
Vertex vertex = vertex().build();
String value = instance.get(vertex);
assertThat(value, is("value2"));
}
use of nl.knaw.huygens.timbuctoo.search.description.PropertyDescriptor in project timbuctoo by HuygensING.
the class CompositePropertyDescriptorTest method getReturnsTheValueOfTheSecondPropDescriptionIfTheValueOfTheFirstOneIsAnEmptyString.
@Test
public void getReturnsTheValueOfTheSecondPropDescriptionIfTheValueOfTheFirstOneIsAnEmptyString() {
PropertyDescriptor propertyDescriptor1 = mock(PropertyDescriptor.class);
given(propertyDescriptor1.get(any(Vertex.class))).willReturn("");
PropertyDescriptor propertyDescriptor2 = mock(PropertyDescriptor.class);
String valueOfDesc2 = "notNull";
given(propertyDescriptor2.get(any(Vertex.class))).willReturn(valueOfDesc2);
CompositePropertyDescriptor instance = new CompositePropertyDescriptor(propertyDescriptor1, propertyDescriptor2);
String value = instance.get(mock(Vertex.class));
assertThat(value, is(valueOfDesc2));
verify(propertyDescriptor1).get(any(Vertex.class));
verify(propertyDescriptor2).get(any(Vertex.class));
}
use of nl.knaw.huygens.timbuctoo.search.description.PropertyDescriptor in project timbuctoo by HuygensING.
the class CompositePropertyDescriptorTest method getReturnsTheValueOfTheFirstPropDescription.
@Test
public void getReturnsTheValueOfTheFirstPropDescription() {
PropertyDescriptor propertyDescriptor1 = mock(PropertyDescriptor.class);
String valueOfDesc1 = "notNull";
given(propertyDescriptor1.get(any(Vertex.class))).willReturn(valueOfDesc1);
PropertyDescriptor propertyDescriptor2 = mock(PropertyDescriptor.class);
CompositePropertyDescriptor instance = new CompositePropertyDescriptor(propertyDescriptor1, propertyDescriptor2);
String value = instance.get(mock(Vertex.class));
assertThat(value, is(valueOfDesc1));
verify(propertyDescriptor1).get(any(Vertex.class));
verifyZeroInteractions(propertyDescriptor2);
}
use of nl.knaw.huygens.timbuctoo.search.description.PropertyDescriptor in project timbuctoo by HuygensING.
the class PropertyDescriptorFactoryTest method getLocalWithPropertyNameAndParserReturnsALocalPropertyDescriptor.
@Test
public void getLocalWithPropertyNameAndParserReturnsALocalPropertyDescriptor() {
PropertyParser parser = mock(PropertyParser.class);
PropertyDescriptor descriptor = instance.getLocal("propertyName", parser);
assertThat(descriptor, is(instanceOf(LocalPropertyDescriptor.class)));
}
Aggregations