summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs.test/tst/org
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-02 11:10:00 +0900
committerMatthias Sohn <matthias.sohn@sap.com>2018-03-03 23:58:49 +0100
commit2d178f5f14366de5a57e94f07e523dffd58451d2 (patch)
treed3274cad0093b194d6c28a61e9f2e807fc3a6bee /org.eclipse.jgit.lfs.test/tst/org
parent91a2be13e5beab05882d275bf5dee7cf14820f9b (diff)
downloadjgit-2d178f5f14366de5a57e94f07e523dffd58451d2.tar.gz
jgit-2d178f5f14366de5a57e94f07e523dffd58451d2.zip
LFSPointerTest: Open ByteArrayOutputStream in try-with-resource
Change-Id: Ib15a838e735f8b960e0ed635d6d9b0caf97f4791 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.test/tst/org')
-rw-r--r--org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
index 2ace2e3ce6..146a25ed3d 100644
--- a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
+++ b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
@@ -61,11 +61,12 @@ public class LFSPointerTest {
final String s = "27e15b72937fc8f558da24ac3d50ec20302a4cf21e33b87ae8e4ce90e89c4b10";
AnyLongObjectId id = LongObjectId.fromString(s);
LfsPointer ptr = new LfsPointer(id, 4);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ptr.encode(baos);
- baos.close();
- assertEquals("version https://git-lfs.github.com/spec/v1\noid sha256:"
- + s + "\nsize 4\n",
- baos.toString(UTF_8.name()));
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+ ptr.encode(baos);
+ assertEquals(
+ "version https://git-lfs.github.com/spec/v1\noid sha256:"
+ + s + "\nsize 4\n",
+ baos.toString(UTF_8.name()));
+ }
}
}