LFSPointerTest: Open ByteArrayOutputStream in try-with-resource

Change-Id: Ib15a838e735f8b960e0ed635d6d9b0caf97f4791
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2018-03-02 11:10:00 +09:00 committed by Matthias Sohn
parent 91a2be13e5
commit 2d178f5f14
1 changed files with 7 additions and 6 deletions

View File

@ -61,11 +61,12 @@ public void testEncoding() throws IOException {
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()));
}
}
}