Tests should manage resources with try-with-resources blocks.
diff --git a/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTest.java b/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTest.java
index 0450f0d..e358a1d 100644
--- a/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTest.java
+++ b/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTest.java
@@ -115,16 +115,16 @@
     }
 
     @Test
-    public void testCreateGraph() {
-        final Graph graph = factory.createGraph();
+    public void testCreateGraph() throws Exception {
+        try (final Graph graph = factory.createGraph(); final Graph graph2 = factory.createGraph()) {
 
-        assertEquals("Graph was not empty", 0, graph.size());
-        graph.add(factory.createBlankNode(), factory.createIRI("http://example.com/"), factory.createBlankNode());
+            assertEquals("Graph was not empty", 0, graph.size());
+            graph.add(factory.createBlankNode(), factory.createIRI("http://example.com/"), factory.createBlankNode());
 
-        final Graph graph2 = factory.createGraph();
-        assertNotSame(graph, graph2);
-        assertEquals("Graph was empty after adding", 1, graph.size());
-        assertEquals("New graph was not empty", 0, graph2.size());
+            assertNotSame(graph, graph2);
+            assertEquals("Graph was empty after adding", 1, graph.size());
+            assertEquals("New graph was not empty", 0, graph2.size());
+        }
     }
 
     @Test
diff --git a/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java b/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java
index aff7a48..83c9bea 100644
--- a/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java
+++ b/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java
@@ -78,41 +78,42 @@
      */
     @Test
     public void addTermsFromOtherFactory() throws Exception {
-        final Graph g = graphFactory.createGraph();
-        final BlankNode s = nodeFactory.createBlankNode();
-        final IRI p = nodeFactory.createIRI("http://example.com/p");
-        final Literal o = nodeFactory.createLiteral("Hello");
+        try (final Graph g = graphFactory.createGraph()) {
+            final BlankNode s = nodeFactory.createBlankNode();
+            final IRI p = nodeFactory.createIRI("http://example.com/p");
+            final Literal o = nodeFactory.createLiteral("Hello");
 
-        g.add(s, p, o);
+            g.add(s, p, o);
 
-        // blankNode should still work with g.contains()
-        assertTrue(g.contains(s, p, o));
-        final Triple t1 = g.stream().findAny().get();
+            // blankNode should still work with g.contains()
+            assertTrue(g.contains(s, p, o));
+            final Triple t1 = g.stream().findAny().get();
 
-        // Can't make assumptions about BlankNode equality - it might
-        // have been mapped to a different BlankNode.uniqueReference()
-        // assertEquals(s, t.getSubject());
+            // Can't make assumptions about BlankNode equality - it might
+            // have been mapped to a different BlankNode.uniqueReference()
+            // assertEquals(s, t.getSubject());
 
-        assertEquals(p, t1.getPredicate());
-        assertEquals(o, t1.getObject());
+            assertEquals(p, t1.getPredicate());
+            assertEquals(o, t1.getObject());
 
-        final IRI s2 = nodeFactory.createIRI("http://example.com/s2");
-        g.add(s2, p, s);
-        assertTrue(g.contains(s2, p, s));
+            final IRI s2 = nodeFactory.createIRI("http://example.com/s2");
+            g.add(s2, p, s);
+            assertTrue(g.contains(s2, p, s));
 
-        // This should be mapped to the same BlankNode
-        // (even if it has a different identifier), e.g.
-        // we should be able to do:
+            // This should be mapped to the same BlankNode
+            // (even if it has a different identifier), e.g.
+            // we should be able to do:
 
-        final Triple t2 = g.stream(s2, p, null).findAny().get();
+            final Triple t2 = g.stream(s2, p, null).findAny().get();
 
-        final BlankNode bnode = (BlankNode) t2.getObject();
-        // And that (possibly adapted) BlankNode object should
-        // match the subject of t1 statement
-        assertEquals(bnode, t1.getSubject());
-        // And can be used as a key:
-        final Triple t3 = g.stream(bnode, p, null).findAny().get();
-        assertEquals(t1, t3);
+            final BlankNode bnode = (BlankNode) t2.getObject();
+            // And that (possibly adapted) BlankNode object should
+            // match the subject of t1 statement
+            assertEquals(bnode, t1.getSubject());
+            // And can be used as a key:
+            final Triple t3 = g.stream(bnode, p, null).findAny().get();
+            assertEquals(t1, t3);
+        }
     }
 
     /**
@@ -125,47 +126,48 @@
      */
     @Test
     public void addTriplesFromOtherFactory() throws Exception {
-        final Graph g = graphFactory.createGraph();
-        final BlankNode s = nodeFactory.createBlankNode();
-        final IRI p = nodeFactory.createIRI("http://example.com/p");
-        final Literal o = nodeFactory.createLiteral("Hello");
+        try (final Graph g = graphFactory.createGraph()) {
+            final BlankNode s = nodeFactory.createBlankNode();
+            final IRI p = nodeFactory.createIRI("http://example.com/p");
+            final Literal o = nodeFactory.createLiteral("Hello");
 
-        final Triple srcT1 = nodeFactory.createTriple(s, p, o);
-        // This should work even with BlankNode as they are from the same
-        // factory
-        assertEquals(s, srcT1.getSubject());
-        assertEquals(p, srcT1.getPredicate());
-        assertEquals(o, srcT1.getObject());
-        g.add(srcT1);
+            final Triple srcT1 = nodeFactory.createTriple(s, p, o);
+            // This should work even with BlankNode as they are from the same
+            // factory
+            assertEquals(s, srcT1.getSubject());
+            assertEquals(p, srcT1.getPredicate());
+            assertEquals(o, srcT1.getObject());
+            g.add(srcT1);
 
-        // what about the blankNode within?
-        assertTrue(g.contains(srcT1));
-        final Triple t1 = g.stream().findAny().get();
+            // what about the blankNode within?
+            assertTrue(g.contains(srcT1));
+            final Triple t1 = g.stream().findAny().get();
 
-        // Can't make assumptions about BlankNode equality - it might
-        // have been mapped to a different BlankNode.uniqueReference()
-        // assertEquals(srcT1, t1);
-        // assertEquals(s, t1.getSubject());
-        assertEquals(p, t1.getPredicate());
-        assertEquals(o, t1.getObject());
+            // Can't make assumptions about BlankNode equality - it might
+            // have been mapped to a different BlankNode.uniqueReference()
+            // assertEquals(srcT1, t1);
+            // assertEquals(s, t1.getSubject());
+            assertEquals(p, t1.getPredicate());
+            assertEquals(o, t1.getObject());
 
-        final IRI s2 = nodeFactory.createIRI("http://example.com/s2");
-        final Triple srcT2 = nodeFactory.createTriple(s2, p, s);
-        g.add(srcT2);
-        assertTrue(g.contains(srcT2));
+            final IRI s2 = nodeFactory.createIRI("http://example.com/s2");
+            final Triple srcT2 = nodeFactory.createTriple(s2, p, s);
+            g.add(srcT2);
+            assertTrue(g.contains(srcT2));
 
-        // This should be mapped to the same BlankNode
-        // (even if it has a different identifier), e.g.
-        // we should be able to do:
+            // This should be mapped to the same BlankNode
+            // (even if it has a different identifier), e.g.
+            // we should be able to do:
 
-        final Triple t2 = g.stream(s2, p, null).findAny().get();
+            final Triple t2 = g.stream(s2, p, null).findAny().get();
 
-        final BlankNode bnode = (BlankNode) t2.getObject();
-        // And that (possibly adapted) BlankNode object should
-        // match the subject of t1 statement
-        assertEquals(bnode, t1.getSubject());
-        // And can be used as a key:
-        final Triple t3 = g.stream(bnode, p, null).findAny().get();
-        assertEquals(t1, t3);
+            final BlankNode bnode = (BlankNode) t2.getObject();
+            // And that (possibly adapted) BlankNode object should
+            // match the subject of t1 statement
+            assertEquals(bnode, t1.getSubject());
+            // And can be used as a key:
+            final Triple t3 = g.stream(bnode, p, null).findAny().get();
+            assertEquals(t1, t3);
+        }
     }
 }
diff --git a/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/JSONLDParsingTest.java b/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/JSONLDParsingTest.java
index 7f5dbb7..a2522ca 100644
--- a/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/JSONLDParsingTest.java
+++ b/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/JSONLDParsingTest.java
@@ -19,7 +19,6 @@
 
 import static org.junit.Assert.assertTrue;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 
@@ -41,8 +40,6 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import com.fasterxml.jackson.core.JsonParseException;
-import com.github.jsonldjava.core.JsonLdError;
 import com.github.jsonldjava.core.JsonLdOptions;
 import com.github.jsonldjava.core.JsonLdProcessor;
 import com.github.jsonldjava.core.RDFDataset;
@@ -114,10 +111,11 @@
         jenaParse(aliceCached);
     }
 
-    private void jenaParse(final URL url) {
-        final JenaDataset dataset = new JenaRDF().createDataset();
-        RDFDataMgr.read(dataset.asJenaDatasetGraph(), url.toExternalForm());
-        checkGraph(dataset.getGraph());
+    private void jenaParse(final URL url) throws Exception {
+        try (final JenaDataset dataset = new JenaRDF().createDataset()) {
+            RDFDataMgr.read(dataset.asJenaDatasetGraph(), url.toExternalForm());
+            checkGraph(dataset.getGraph());
+        }
     }
 
     @Test
@@ -132,13 +130,14 @@
         rdf4jParse(aliceCached);
     }
 
-    private void rdf4jParse(final URL url) throws IOException {
+    private void rdf4jParse(final URL url) throws Exception {
         Model model;
         try (InputStream in = url.openStream()) {
             model = Rio.parse(in, url.toExternalForm(), RDFFormat.JSONLD);
         }
-        final RDF4JGraph graph = new RDF4J().asGraph(model);
-        checkGraph(graph);
+        try (final RDF4JGraph graph = new RDF4J().asGraph(model)) {
+            checkGraph(graph);
+        }
     }
 
     @Test
@@ -153,12 +152,13 @@
         jsonldParse(aliceCached);
     }
 
-    private void jsonldParse(final URL url) throws JsonParseException, IOException, JsonLdError {
+    private void jsonldParse(final URL url) throws Exception {
         final Object aliceJson = JsonUtils.fromURL(url, JsonUtils.getDefaultHttpClient());
         final JsonLdOptions options = new JsonLdOptions();
         options.setBase(url.toExternalForm());
         final RDFDataset ds = (RDFDataset) JsonLdProcessor.toRDF(aliceJson);
-        final JsonLdGraph graph = new JsonLdRDF().asGraph(ds);
-        checkGraph(graph);
+        try (final JsonLdGraph graph = new JsonLdRDF().asGraph(ds)) {
+            checkGraph(graph);
+        }
     }
 }