use of nl.knaw.huygens.timbuctoo.core.dto.property.HyperLinksProperty in project timbuctoo by HuygensING.
the class EntityToJsonMapperTest method doesNotAddNonConvertableProperties.
@Test
public void doesNotAddNonConvertableProperties() {
ReadEntityImpl readEntity = new ReadEntityImpl();
readEntity.setId(UUID.randomUUID());
String userId = "userId";
Change change = new Change(Instant.now().toEpochMilli(), userId, null);
readEntity.setCreated(change);
readEntity.setModified(change);
String type = "otherType";
readEntity.setTypes(Lists.newArrayList("type", type));
readEntity.setDeleted(false);
readEntity.setRev(1);
readEntity.setPid("pid");
ArrayList<TimProperty<?>> properties = Lists.newArrayList();
properties.add(new HyperLinksProperty("nonParsableProp", "Name"));
readEntity.setProperties(properties);
EntityToJsonMapper instance = new EntityToJsonMapper(userValidator, (collection, id1, rev) -> URI.create("www.example.com"));
Collection collection = mock(Collection.class);
when(collection.getEntityTypeName()).thenReturn(type);
ObjectNode resutlJson = instance.mapEntity(collection, readEntity, false, (readEntity1, resultJson) -> {
}, (relationRef, resultJson) -> {
});
assertThat(Lists.newArrayList(resutlJson.fieldNames()), not(hasItem("nonParsableProp")));
}
use of nl.knaw.huygens.timbuctoo.core.dto.property.HyperLinksProperty in project timbuctoo by HuygensING.
the class TriplePropertyConverterTest method toCreatesABlankNodeForALink.
@Test
public void toCreatesABlankNodeForALink() throws Exception {
Tuple<String, List<Triple>> to = instance.to(new HyperLinksProperty(PROP_NAME, "[{\"url\":\"http://www.example.org\",\"label\":\"label\"}]"));
assertThat(to.getRight(), containsInAnyOrder(allOf(hasProperty("subject", is(SUBJECT_URI)), hasProperty("predicate", endsWith(PROP_NAME)), hasProperty("object", startsWith("_:"))), allOf(hasProperty("subject", startsWith("_:")), hasProperty("predicate", endsWith(PROP_NAME + "url")), hasProperty("object", is("http://www.example.org"))), allOf(hasProperty("subject", startsWith("_:")), hasProperty("predicate", endsWith(PROP_NAME + "label")), hasProperty("object", is("label")))));
}
Aggregations