TreeFilterTest: Open TreeWalk in try-with-resource
Change-Id: If100a66e544926bcffe9a9a0b31bfd4806902864 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
This commit is contained in:
parent
62637584d8
commit
a82f5c7425
|
@ -55,10 +55,11 @@
|
||||||
public class TreeFilterTest extends RepositoryTestCase {
|
public class TreeFilterTest extends RepositoryTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testALL_IncludesAnything() throws Exception {
|
public void testALL_IncludesAnything() throws Exception {
|
||||||
final TreeWalk tw = new TreeWalk(db);
|
try (final TreeWalk tw = new TreeWalk(db)) {
|
||||||
tw.addTree(new EmptyTreeIterator());
|
tw.addTree(new EmptyTreeIterator());
|
||||||
assertTrue(TreeFilter.ALL.include(tw));
|
assertTrue(TreeFilter.ALL.include(tw));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testALL_ShouldNotBeRecursive() throws Exception {
|
public void testALL_ShouldNotBeRecursive() throws Exception {
|
||||||
|
@ -72,17 +73,19 @@ public void testALL_IdentityClone() throws Exception {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNotALL_IncludesNothing() throws Exception {
|
public void testNotALL_IncludesNothing() throws Exception {
|
||||||
final TreeWalk tw = new TreeWalk(db);
|
try (final TreeWalk tw = new TreeWalk(db)) {
|
||||||
tw.addTree(new EmptyTreeIterator());
|
tw.addTree(new EmptyTreeIterator());
|
||||||
assertFalse(TreeFilter.ALL.negate().include(tw));
|
assertFalse(TreeFilter.ALL.negate().include(tw));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testANY_DIFF_IncludesSingleTreeCase() throws Exception {
|
public void testANY_DIFF_IncludesSingleTreeCase() throws Exception {
|
||||||
final TreeWalk tw = new TreeWalk(db);
|
try (final TreeWalk tw = new TreeWalk(db)) {
|
||||||
tw.addTree(new EmptyTreeIterator());
|
tw.addTree(new EmptyTreeIterator());
|
||||||
assertTrue(TreeFilter.ANY_DIFF.include(tw));
|
assertTrue(TreeFilter.ANY_DIFF.include(tw));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testANY_DIFF_ShouldNotBeRecursive() throws Exception {
|
public void testANY_DIFF_ShouldNotBeRecursive() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue