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"))));
}
Aggregations