SquashMessageFormatterTest: Open git in try-with-resource

Change-Id: Ife94d1f0279ed3671a9bca79fb26c0403549fa17
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
This commit is contained in:
David Pursehouse 2016-02-05 17:05:05 +09:00
parent 6aa619ec5c
commit d882bf8c4d
1 changed files with 12 additions and 11 deletions

View File

@ -73,17 +73,18 @@ public void setUp() throws Exception {
@Test @Test
public void testCommit() throws Exception { public void testCommit() throws Exception {
Git git = new Git(db); try (Git git = new Git(db)) {
revCommit = git.commit().setMessage("squash_me").call(); revCommit = git.commit().setMessage("squash_me").call();
Ref master = db.exactRef("refs/heads/master"); Ref master = db.exactRef("refs/heads/master");
String message = msgFormatter.format(Arrays.asList(revCommit), master); String message = msgFormatter.format(Arrays.asList(revCommit), master);
assertEquals( assertEquals(
"Squashed commit of the following:\n\ncommit " "Squashed commit of the following:\n\ncommit "
+ revCommit.getName() + "\nAuthor: " + revCommit.getName() + "\nAuthor: "
+ revCommit.getAuthorIdent().getName() + " <" + revCommit.getAuthorIdent().getName() + " <"
+ revCommit.getAuthorIdent().getEmailAddress() + revCommit.getAuthorIdent().getEmailAddress()
+ ">\nDate: " + dateFormatter.formatDate(author) + ">\nDate: " + dateFormatter.formatDate(author)
+ "\n\n\tsquash_me\n", message); + "\n\n\tsquash_me\n", message);
}
} }
} }