Search in sources :

Example 1 with StringArrayToEncodedArrayOfLimitedValues

use of nl.knaw.huygens.timbuctoo.model.properties.converters.StringArrayToEncodedArrayOfLimitedValues in project timbuctoo by HuygensING.

the class LocalPropertyTest method saveSetsOptionsPropertyWhenTheConverterHasOptions.

@Test
public void saveSetsOptionsPropertyWhenTheConverterHasOptions() throws JsonProcessingException {
    final String propertyName = "testProp";
    final String clientPropName = "clientPropName";
    final String[] options = { "val1", "val2" };
    Converter converter = new StringArrayToEncodedArrayOfLimitedValues(options);
    LocalProperty property = new LocalProperty(propertyName, converter);
    Vertex result = property.save(graph, clientPropName);
    assertThat(result, likeVertex().withProperty(OPTIONS_PROPERTY_NAME, new ObjectMapper().writeValueAsString(options)).withProperty(PROPERTY_TYPE_NAME, converter.getUniqueTypeIdentifier()));
}
Also used : Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) VertexMatcher.likeVertex(nl.knaw.huygens.timbuctoo.util.VertexMatcher.likeVertex) Converter(nl.knaw.huygens.timbuctoo.model.properties.converters.Converter) StringArrayToEncodedArrayOfLimitedValues(nl.knaw.huygens.timbuctoo.model.properties.converters.StringArrayToEncodedArrayOfLimitedValues) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Converter (nl.knaw.huygens.timbuctoo.model.properties.converters.Converter)1 StringArrayToEncodedArrayOfLimitedValues (nl.knaw.huygens.timbuctoo.model.properties.converters.StringArrayToEncodedArrayOfLimitedValues)1 VertexMatcher.likeVertex (nl.knaw.huygens.timbuctoo.util.VertexMatcher.likeVertex)1 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)1 Test (org.junit.Test)1