use of org.wikidata.wdtk.datamodel.interfaces.ItemUpdate in project OpenRefine by OpenRefine.
the class TermedStatementEntityEditTest method testToEntityUpdate.
@Test
public void testToEntityUpdate() {
TermedStatementEntityEdit edit = new TermedStatementEntityEditBuilder(existingSubject).addAlias(Datamodel.makeMonolingualTextValue("alias", "en")).addStatement(statementUpdate1).build();
ItemDocument itemDocument = ItemDocumentBuilder.forItemId(existingSubject).withStatement(statement2).withLabel(Datamodel.makeMonolingualTextValue("label", "en")).build();
ItemUpdate update = (ItemUpdate) edit.toEntityUpdate(itemDocument);
assertEquals(update.getEntityId(), existingSubject);
assertEquals(update.getAliases(), Collections.singletonMap("en", Datamodel.makeAliasUpdate(Collections.singletonList(Datamodel.makeMonolingualTextValue("alias", "en")), Collections.emptyList())));
assertTrue(update.getDescriptions().isEmpty());
assertTrue(update.getLabels().isEmpty());
assertEquals(update.getStatements(), Datamodel.makeStatementUpdate(Collections.singletonList(statement1), Collections.emptyList(), Collections.emptySet()));
}
Aggregations