StatusCommandTest: Open Git in try-with-resource
Change-Id: Id13ad9fa3157d0479da12fb8184437be3ca8c948 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
This commit is contained in:
parent
96ff311049
commit
6aa619ec5c
|
@ -61,8 +61,7 @@ public class StatusCommandTest extends RepositoryTestCase {
|
|||
@Test
|
||||
public void testEmptyStatus() throws NoWorkTreeException,
|
||||
GitAPIException {
|
||||
Git git = new Git(db);
|
||||
|
||||
try (Git git = new Git(db)) {
|
||||
Status stat = git.status().call();
|
||||
assertEquals(0, stat.getAdded().size());
|
||||
assertEquals(0, stat.getChanged().size());
|
||||
|
@ -71,11 +70,12 @@ public void testEmptyStatus() throws NoWorkTreeException,
|
|||
assertEquals(0, stat.getRemoved().size());
|
||||
assertEquals(0, stat.getUntracked().size());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDifferentStates() throws IOException,
|
||||
NoFilepatternException, GitAPIException {
|
||||
Git git = new Git(db);
|
||||
try (Git git = new Git(db)) {
|
||||
writeTrashFile("a", "content of a");
|
||||
writeTrashFile("b", "content of b");
|
||||
writeTrashFile("c", "content of c");
|
||||
|
@ -130,11 +130,12 @@ public void testDifferentStates() throws IOException,
|
|||
assertEquals(1, stat.getUntrackedFolders().size());
|
||||
assertTrue(stat.getUntrackedFolders().contains("sub"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDifferentStatesWithPaths() throws IOException,
|
||||
NoFilepatternException, GitAPIException {
|
||||
Git git = new Git(db);
|
||||
try (Git git = new Git(db)) {
|
||||
writeTrashFile("a", "content of a");
|
||||
writeTrashFile("D/b", "content of b");
|
||||
writeTrashFile("D/c", "content of c");
|
||||
|
@ -166,4 +167,5 @@ public void testDifferentStatesWithPaths() throws IOException,
|
|||
stat = git.status().call();
|
||||
assertEquals(Sets.of("a", "D/b", "D/D/d"), stat.getModified());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue