use of nl.knaw.huygens.timbuctoo.core.RdfImportErrorReporter in project timbuctoo by HuygensING.
the class CollectionMembershipTripleProcessorTest method processLogsAnExceptionWhenTheEntityAlreadyIsPartOfACollectionWhenAsserted.
@Test
public void processLogsAnExceptionWhenTheEntityAlreadyIsPartOfACollectionWhenAsserted() {
Database database = mock(Database.class);
Collection collectionFromTriple = mock(Collection.class);
Collection archetypeCollection = mock(Collection.class);
when(collectionFromTriple.getArchetype()).thenReturn(Optional.of(archetypeCollection));
when(database.findOrCreateCollection(anyString(), anyString(), anyString())).thenReturn(collectionFromTriple);
Collection defaultCollection = mock(Collection.class);
when(database.getDefaultCollection("vreName")).thenReturn(defaultCollection);
Entity entity = mock(Entity.class);
when(entity.isInKnownCollection()).thenReturn(true);
when(database.findOrCreateEntity("vreName", SUBJECT_URI)).thenReturn(entity);
RdfImportSession rdfImportSession = mock(RdfImportSession.class);
RdfImportErrorReporter errorReporter = mock(RdfImportErrorReporter.class);
when(rdfImportSession.getErrorReporter()).thenReturn(errorReporter);
CollectionMembershipTripleProcessor instance = new CollectionMembershipTripleProcessor(database, rdfImportSession);
instance.process("vreName", SUBJECT_URI, PREDICATE_URI, OBJECT_URI, true);
verify(errorReporter).multipleRdfTypes(SUBJECT_URI, OBJECT_URI);
}
Aggregations