@Test public void testGetStatements() throws Exception { testCon.add(bob, name, nameBob); assertTrue("Repository should contain statement", testCon.hasStatement(bob, name, nameBob, false)); RepositoryResult<Statement> result = testCon.getStatements(null, name, null, false); try { assertNotNull("Iterator should not be null", result); assertTrue("Iterator should not be empty", result.hasNext()); while (result.hasNext()) { Statement st = result.next(); assertNull("Statement should not be in a context ", st.getContext()); assertTrue("Statement predicate should be equal to name ", st.getPredicate().equals(name)); } } finally { result.close(); } List<Statement> list = Iterations.addAll(testCon.getStatements(null, name, null, false), new ArrayList<Statement>()); assertNotNull("List should not be null", list); assertFalse("List should not be empty", list.isEmpty()); }
@Test public void testGetStatements() throws Exception { testCon.add(bob, name, nameBob); assertTrue("Repository should contain statement", testCon.hasStatement(bob, name, nameBob, false)); RepositoryResult<Statement> result = testCon.getStatements(null, name, null, false); try { assertNotNull("Iterator should not be null", result); assertTrue("Iterator should not be empty", result.hasNext()); while (result.hasNext()) { Statement st = result.next(); assertNull("Statement should not be in a context ", st.getContext()); assertTrue("Statement predicate should be equal to name ", st.getPredicate().equals(name)); } } finally { result.close(); } List<Statement> list = Iterations.addAll(testCon.getStatements(null, name, null, false), new ArrayList<Statement>()); assertNotNull("List should not be null", list); assertFalse("List should not be empty", list.isEmpty()); }