Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse2016-02-05 02:44:12 +0000
committerDavid Pursehouse2016-02-05 02:44:12 +0000
commita82f5c7425e6078f8345b16200a5127742deb437 (patch)
treedf39c0f859daaf5d7effc107fb92e897b27ebe4b
parent62637584d87cbb0d83263d9c541827c6c99a69de (diff)
downloadjgit-a82f5c7425e6078f8345b16200a5127742deb437.tar.gz
jgit-a82f5c7425e6078f8345b16200a5127742deb437.tar.xz
jgit-a82f5c7425e6078f8345b16200a5127742deb437.zip
TreeFilterTest: Open TreeWalk in try-with-resource
Change-Id: If100a66e544926bcffe9a9a0b31bfd4806902864 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java
index 09007e7cb5..c3423b6fb1 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java
@@ -55,9 +55,10 @@ import org.junit.Test;
public class TreeFilterTest extends RepositoryTestCase {
@Test
public void testALL_IncludesAnything() throws Exception {
- final TreeWalk tw = new TreeWalk(db);
- tw.addTree(new EmptyTreeIterator());
- assertTrue(TreeFilter.ALL.include(tw));
+ try (final TreeWalk tw = new TreeWalk(db)) {
+ tw.addTree(new EmptyTreeIterator());
+ assertTrue(TreeFilter.ALL.include(tw));
+ }
}
@Test
@@ -72,16 +73,18 @@ public class TreeFilterTest extends RepositoryTestCase {
@Test
public void testNotALL_IncludesNothing() throws Exception {
- final TreeWalk tw = new TreeWalk(db);
- tw.addTree(new EmptyTreeIterator());
- assertFalse(TreeFilter.ALL.negate().include(tw));
+ try (final TreeWalk tw = new TreeWalk(db)) {
+ tw.addTree(new EmptyTreeIterator());
+ assertFalse(TreeFilter.ALL.negate().include(tw));
+ }
}
@Test
public void testANY_DIFF_IncludesSingleTreeCase() throws Exception {
- final TreeWalk tw = new TreeWalk(db);
- tw.addTree(new EmptyTreeIterator());
- assertTrue(TreeFilter.ANY_DIFF.include(tw));
+ try (final TreeWalk tw = new TreeWalk(db)) {
+ tw.addTree(new EmptyTreeIterator());
+ assertTrue(TreeFilter.ANY_DIFF.include(tw));
+ }
}
@Test

Back to the top