Browse Source

LFSPointerTest: Open ByteArrayOutputStream in try-with-resource

Change-Id: Ib15a838e735f8b960e0ed635d6d9b0caf97f4791
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.11
David Pursehouse 7 years ago committed by Matthias Sohn
parent
commit
2d178f5f14
  1. 13
      org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java

13
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()));
}
}
}

Loading…
Cancel
Save