Search in sources :

Example 1 with RdfImportErrorReporter

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);
}
Also used : Entity(nl.knaw.huygens.timbuctoo.rdf.Entity) RdfImportSession(nl.knaw.huygens.timbuctoo.core.RdfImportSession) RdfImportErrorReporter(nl.knaw.huygens.timbuctoo.core.RdfImportErrorReporter) Database(nl.knaw.huygens.timbuctoo.rdf.Database) Collection(nl.knaw.huygens.timbuctoo.rdf.Collection) Test(org.junit.Test)

Aggregations

RdfImportErrorReporter (nl.knaw.huygens.timbuctoo.core.RdfImportErrorReporter)1 RdfImportSession (nl.knaw.huygens.timbuctoo.core.RdfImportSession)1 Collection (nl.knaw.huygens.timbuctoo.rdf.Collection)1 Database (nl.knaw.huygens.timbuctoo.rdf.Database)1 Entity (nl.knaw.huygens.timbuctoo.rdf.Entity)1 Test (org.junit.Test)1