RevCommitParseTest: Open ObjectInserter.Formatter in try-with-resource

Change-Id: Iaa87c51bc19b4fa832393c11db20b69865d30d48
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
This commit is contained in:
David Pursehouse 2016-02-05 17:20:51 +09:00
parent f0ef7748b4
commit 5bfdc3341c
1 changed files with 3 additions and 2 deletions

View File

@ -452,9 +452,10 @@ public void testParse_GitStyleMessage() throws Exception {
@Test
public void testParse_PublicParseMethod()
throws UnsupportedEncodingException {
ObjectInserter.Formatter fmt = new ObjectInserter.Formatter();
CommitBuilder src = new CommitBuilder();
src.setTreeId(fmt.idFor(Constants.OBJ_TREE, new byte[] {}));
try (ObjectInserter.Formatter fmt = new ObjectInserter.Formatter()) {
src.setTreeId(fmt.idFor(Constants.OBJ_TREE, new byte[] {}));
}
src.setAuthor(author);
src.setCommitter(committer);
src.setMessage("Test commit\n\nThis is a test.\n");