Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse2016-02-05 08:05:05 +0000
committerDavid Pursehouse2016-02-05 08:05:05 +0000
commitd882bf8c4de91e5fc35379ab8731d7ad15d21369 (patch)
treed5a252bc739ffc238ce8b41e06c2ce3fde38ae9e
parent6aa619ec5cf7dc2d4149fa8087d985c801223639 (diff)
downloadjgit-d882bf8c4de91e5fc35379ab8731d7ad15d21369.tar.gz
jgit-d882bf8c4de91e5fc35379ab8731d7ad15d21369.tar.xz
jgit-d882bf8c4de91e5fc35379ab8731d7ad15d21369.zip
SquashMessageFormatterTest: Open git in try-with-resource
Change-Id: Ife94d1f0279ed3671a9bca79fb26c0403549fa17 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SquashMessageFormatterTest.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SquashMessageFormatterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SquashMessageFormatterTest.java
index cddbbd528b..7a2586dca8 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SquashMessageFormatterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SquashMessageFormatterTest.java
@@ -73,17 +73,18 @@ public class SquashMessageFormatterTest extends SampleDataRepositoryTestCase {
@Test
public void testCommit() throws Exception {
- Git git = new Git(db);
- revCommit = git.commit().setMessage("squash_me").call();
+ try (Git git = new Git(db)) {
+ revCommit = git.commit().setMessage("squash_me").call();
- Ref master = db.exactRef("refs/heads/master");
- String message = msgFormatter.format(Arrays.asList(revCommit), master);
- assertEquals(
- "Squashed commit of the following:\n\ncommit "
- + revCommit.getName() + "\nAuthor: "
- + revCommit.getAuthorIdent().getName() + " <"
- + revCommit.getAuthorIdent().getEmailAddress()
- + ">\nDate: " + dateFormatter.formatDate(author)
- + "\n\n\tsquash_me\n", message);
+ Ref master = db.exactRef("refs/heads/master");
+ String message = msgFormatter.format(Arrays.asList(revCommit), master);
+ assertEquals(
+ "Squashed commit of the following:\n\ncommit "
+ + revCommit.getName() + "\nAuthor: "
+ + revCommit.getAuthorIdent().getName() + " <"
+ + revCommit.getAuthorIdent().getEmailAddress()
+ + ">\nDate: " + dateFormatter.formatDate(author)
+ + "\n\n\tsquash_me\n", message);
+ }
}
}

Back to the top