Browse Source

IndexModificationTimesTest: Open Git instances in try-with-resource

Change-Id: If52c071b71f5df822b1ac276a6f665515f6c9d00
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
stable-4.2
David Pursehouse 9 years ago
parent
commit
217760fee5
  1. 7
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexModificationTimesTest.java

7
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexModificationTimesTest.java

@ -49,7 +49,7 @@ public class IndexModificationTimesTest extends RepositoryTestCase {
@Test @Test
public void testLastModifiedTimes() throws Exception { public void testLastModifiedTimes() throws Exception {
Git git = new Git(db); try (Git git = new Git(db)) {
String path = "file"; String path = "file";
writeTrashFile(path, "content"); writeTrashFile(path, "content");
String path2 = "file2"; String path2 = "file2";
@ -83,10 +83,11 @@ public class IndexModificationTimesTest extends RepositoryTestCase {
assertTrue("last modified shall not be zero!", assertTrue("last modified shall not be zero!",
entry2.getLastModified() != 0); entry2.getLastModified() != 0);
} }
}
@Test @Test
public void testModify() throws Exception { public void testModify() throws Exception {
Git git = new Git(db); try (Git git = new Git(db)) {
String path = "file"; String path = "file";
writeTrashFile(path, "content"); writeTrashFile(path, "content");
@ -122,7 +123,7 @@ public class IndexModificationTimesTest extends RepositoryTestCase {
assertTrue("shall have equal mod time!", masterLastMod == sideLastMode); assertTrue("shall have equal mod time!", masterLastMod == sideLastMode);
assertTrue("shall not equal master timestamp!", assertTrue("shall not equal master timestamp!",
entry.getLastModified() == masterLastMod); entry.getLastModified() == masterLastMod);
}
} }
} }

Loading…
Cancel
Save