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
@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