Search in sources :

Example 1 with AltNamesProperty

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

the class JsonPropertyConverterTest method toConvertsTheListOfAltNamesToAnArrayNode.

@Test
public void toConvertsTheListOfAltNamesToAnArrayNode() throws Exception {
    JsonPropertyConverter jsonPropertyConverter = new JsonPropertyConverter(null);
    AltNames altNames = new AltNames();
    altNames.list = Lists.newArrayList(new AltName("type1", "name1"), new AltName("type2", "name2"));
    Tuple<String, JsonNode> valueTuple = jsonPropertyConverter.to(new AltNamesProperty("test", altNames));
    JsonNode value = valueTuple.getRight();
    assertThat(value.isArray(), is(true));
    assertThat(Lists.newArrayList(value.iterator()), containsInAnyOrder(jsnO("nametype", jsn("type1"), "displayName", jsn("name1")), jsnO("nametype", jsn("type2"), "displayName", jsn("name2"))));
}
Also used : AltNamesProperty(nl.knaw.huygens.timbuctoo.core.dto.property.AltNamesProperty) AltNames(nl.knaw.huygens.timbuctoo.model.AltNames) JsonNode(com.fasterxml.jackson.databind.JsonNode) AltName(nl.knaw.huygens.timbuctoo.model.AltName) JsonPropertyConverter(nl.knaw.huygens.timbuctoo.crud.conversion.JsonPropertyConverter) Test(org.junit.Test)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 AltNamesProperty (nl.knaw.huygens.timbuctoo.core.dto.property.AltNamesProperty)1 JsonPropertyConverter (nl.knaw.huygens.timbuctoo.crud.conversion.JsonPropertyConverter)1 AltName (nl.knaw.huygens.timbuctoo.model.AltName)1 AltNames (nl.knaw.huygens.timbuctoo.model.AltNames)1 Test (org.junit.Test)1