MainAxiomLoader { boolean contains(Axiom<?> axiom, URI context) { return axiom.getAssertion().isInferred() ? inferredLoader.contains(axiom, context) : explicitLoader.contains(axiom, context); } MainAxiomLoader(StorageConnector connector, InferredStorageConnector inferredConnector);   }
@Test public void containsChecksForNonInferredStatementsOnlyWhenAssertionIsNotInferred() { final Resource cls = createResource(Generator.generateUri().toString()); when(connectorMock.contains(SUBJECT_RES, RDF.type, cls, null)).thenReturn(true); final Axiom<NamedResource> axiom = new AxiomImpl<>(SUBJECT, Assertion.createClassAssertion(false), new Value<>(NamedResource.create(cls.getURI()))); assertTrue(axiomLoader.contains(axiom, null)); verify(connectorMock).contains(SUBJECT_RES, RDF.type, cls, null); verify(inferredConnectorMock, never()).containsWithInference(SUBJECT_RES, RDF.type, cls, null); }
@Test public void containsChecksForInferredStatementsWhenAssertionIsInferred() { final Resource cls = createResource(Generator.generateUri().toString()); when(inferredConnectorMock.containsWithInference(SUBJECT_RES, RDF.type, cls, null)).thenReturn(true); final Axiom<NamedResource> axiom = new AxiomImpl<>(SUBJECT, Assertion.createClassAssertion(true), new Value<>(NamedResource.create(cls.getURI()))); assertTrue(axiomLoader.contains(axiom, null)); verify(connectorMock, never()).contains(SUBJECT_RES, RDF.type, cls, null); verify(inferredConnectorMock).containsWithInference(SUBJECT_RES, RDF.type, cls, null); }