diff --git a/libraries-data/src/test/java/com/baeldung/ormlite/ORMLiteTest.java b/libraries-data/src/test/java/com/baeldung/ormlite/ORMLiteTest.java index eaa21b6eaf..26eb481286 100644 --- a/libraries-data/src/test/java/com/baeldung/ormlite/ORMLiteTest.java +++ b/libraries-data/src/test/java/com/baeldung/ormlite/ORMLiteTest.java @@ -76,13 +76,10 @@ public class ORMLiteTest { library2.setName("My Other Library"); libraryDao.create(library2); - CloseableWrappedIterable wrappedIterable = libraryDao.getWrappedIterable(); - try { + try (CloseableWrappedIterable wrappedIterable = libraryDao.getWrappedIterable()) { wrappedIterable.forEach(lib -> { System.out.println(lib.getName()); }); - } finally { - wrappedIterable.close(); } }