Browse Source

TreeWalkJava7Test: Open TreeWalk in try-with-resource

Change-Id: I99a483c482b5395653b0d57b368ec1b5fdba450c
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
stable-4.2
David Pursehouse 9 years ago
parent
commit
62637584d8
  1. 17
      org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkJava7Test.java

17
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkJava7Test.java

@ -60,13 +60,14 @@ public class TreeWalkJava7Test extends RepositoryTestCase {
assertTrue(fs.supportsSymlinks()); assertTrue(fs.supportsSymlinks());
writeTrashFile("target/data", "targetdata"); writeTrashFile("target/data", "targetdata");
fs.createSymLink(new File(trash, "link"), "target"); fs.createSymLink(new File(trash, "link"), "target");
TreeWalk tw = new TreeWalk(db); try (TreeWalk tw = new TreeWalk(db)) {
tw.setRecursive(true); tw.setRecursive(true);
tw.addTree(new FileTreeIterator(db)); tw.addTree(new FileTreeIterator(db));
assertTrue(tw.next()); assertTrue(tw.next());
assertEquals("link", tw.getPathString()); assertEquals("link", tw.getPathString());
assertTrue(tw.next()); assertTrue(tw.next());
assertEquals("target/data", tw.getPathString()); assertEquals("target/data", tw.getPathString());
assertFalse(tw.next()); assertFalse(tw.next());
}
} }
} }

Loading…
Cancel
Save