SparqlQueryFactory implements QueryFactory { @Override public QueryImpl createQuery(String query) { Objects.requireNonNull(query); final QueryImpl q = new QueryImpl(soqlQueryParser.parseQuery(query), connection); q.useBackupOntology(uow.useBackupOntologyForQueryProcessing()); return q; } SparqlQueryFactory(UnitOfWorkImpl uow, ConnectionWrapper connection); @Override QueryImpl createNativeQuery(String sparql); @Override TypedQueryImpl<T> createNativeQuery(String sparql, Class<T> resultClass); @Override QueryImpl createNativeQuery(String sparql, String resultSetMapping); @Override QueryImpl createQuery(String query); @Override TypedQueryImpl<T> createQuery(String query, Class<T> resultClass); @Override QueryImpl createNamedQuery(String name); @Override TypedQueryImpl<T> createNamedQuery(String name, Class<T> resultClass);  }
@Test public void testCreateQuery() { final Query q = factory.createQuery(SOQL_QUERY); assertNotNull(q); verify(uowMock).useBackupOntologyForQueryProcessing(); }
@Test(expected = NullPointerException.class) public void testCreateQueryNull() { final Query q = factory.createQuery(null); assert q == null; }
@Test public void testCreateQueryTyped() { final TypedQuery<OWLClassA> q = factory.createQuery(SOQL_QUERY, CLS); assertNotNull(q); verify(uowMock).useBackupOntologyForQueryProcessing(); }
@Test(expected = NullPointerException.class) public void testCreateQueryTypedNullQuery() { final TypedQuery<OWLClassA> q = factory.createQuery(null, CLS); assert q == null; }
@Test(expected = NullPointerException.class) public void testCreateQueryTypedNullType() { final TypedQuery<OWLClassA> q = factory.createQuery(SOQL_QUERY, null); assert q == null; }