Search in sources :

Example 1 with DatableProperty

use of nl.knaw.huygens.timbuctoo.core.dto.property.DatableProperty in project timbuctoo by HuygensING.

the class JsonPropertyConverterTest method toReturnsAJsonEncodedStringForADatableProperty.

@Test
public void toReturnsAJsonEncodedStringForADatableProperty() throws Exception {
    JsonPropertyConverter instance = new JsonPropertyConverter(null);
    DatableProperty property = new DatableProperty("prop", "1800");
    Tuple<String, JsonNode> value = instance.to(property);
    assertThat(value.getRight(), is(jsn("1800")));
}
Also used : DatableProperty(nl.knaw.huygens.timbuctoo.core.dto.property.DatableProperty) JsonNode(com.fasterxml.jackson.databind.JsonNode) JsonPropertyConverter(nl.knaw.huygens.timbuctoo.crud.conversion.JsonPropertyConverter) Test(org.junit.Test)

Example 2 with DatableProperty

use of nl.knaw.huygens.timbuctoo.core.dto.property.DatableProperty in project timbuctoo by HuygensING.

the class TinkerPopPropertyConverterTest method toReturnsAJsonEncodedStringForADatableProperty.

@Test
public void toReturnsAJsonEncodedStringForADatableProperty() throws Exception {
    TinkerPopPropertyConverter instance = new TinkerPopPropertyConverter(null);
    DatableProperty property = new DatableProperty(PROPERTY_NAME, "1800");
    Tuple<String, Object> value = instance.to(property);
    assertThat(value.getRight(), is("\"1800\""));
}
Also used : TinkerPopPropertyConverter(nl.knaw.huygens.timbuctoo.database.tinkerpop.conversion.TinkerPopPropertyConverter) DatableProperty(nl.knaw.huygens.timbuctoo.core.dto.property.DatableProperty) Test(org.junit.Test)

Example 3 with DatableProperty

use of nl.knaw.huygens.timbuctoo.core.dto.property.DatableProperty in project timbuctoo by HuygensING.

the class JsonPropertyConverterTest method toConvertsADatablePropertyToAString.

@Test
public void toConvertsADatablePropertyToAString() throws Exception {
    JsonPropertyConverter instance = new JsonPropertyConverter(null);
    DatableProperty datableProperty = new DatableProperty("", "2016-01-02");
    Tuple<String, JsonNode> value = instance.to(datableProperty);
    assertThat(value.getRight(), is(jsn("2016-01-02")));
}
Also used : DatableProperty(nl.knaw.huygens.timbuctoo.core.dto.property.DatableProperty) JsonNode(com.fasterxml.jackson.databind.JsonNode) JsonPropertyConverter(nl.knaw.huygens.timbuctoo.crud.conversion.JsonPropertyConverter) Test(org.junit.Test)

Example 4 with DatableProperty

use of nl.knaw.huygens.timbuctoo.core.dto.property.DatableProperty in project timbuctoo by HuygensING.

the class TinkerPopPropertyConverterTest method toThrowsAnExceptionWhenTheDateFormatIsNotSupported.

@Test(expected = IOException.class)
public void toThrowsAnExceptionWhenTheDateFormatIsNotSupported() throws Exception {
    TinkerPopPropertyConverter instance = new TinkerPopPropertyConverter(null);
    DatableProperty property = new DatableProperty(PROPERTY_NAME, "01-02-180");
    instance.to(property);
}
Also used : TinkerPopPropertyConverter(nl.knaw.huygens.timbuctoo.database.tinkerpop.conversion.TinkerPopPropertyConverter) DatableProperty(nl.knaw.huygens.timbuctoo.core.dto.property.DatableProperty) Test(org.junit.Test)

Aggregations

DatableProperty (nl.knaw.huygens.timbuctoo.core.dto.property.DatableProperty)4 Test (org.junit.Test)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 JsonPropertyConverter (nl.knaw.huygens.timbuctoo.crud.conversion.JsonPropertyConverter)2 TinkerPopPropertyConverter (nl.knaw.huygens.timbuctoo.database.tinkerpop.conversion.TinkerPopPropertyConverter)2