Browse Source

TemporaryBufferTest: Open TemporaryBuffer in try-with-resource

Except the cases where the warning was suppressed in bf757cd because
they are explicitly testing functionality that is not possible in t-w-r.

Change-Id: I6c66eb31a2314028e09a9213dc695cd163f907e9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.4
David Pursehouse 6 years ago
parent
commit
95d74f22fb
  1. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java

@ -404,8 +404,7 @@ public class TemporaryBufferTest {
@Test @Test
public void testHeap() throws IOException { public void testHeap() throws IOException {
@SuppressWarnings("resource" /* java 7 */) try (TemporaryBuffer b = new TemporaryBuffer.Heap(2 * 8 * 1024)) {
final TemporaryBuffer b = new TemporaryBuffer.Heap(2 * 8 * 1024);
final byte[] r = new byte[8 * 1024]; final byte[] r = new byte[8 * 1024];
b.write(r); b.write(r);
b.write(r); b.write(r);
@ -416,6 +415,7 @@ public class TemporaryBufferTest {
assertEquals("In-memory buffer limit exceeded", e.getMessage()); assertEquals("In-memory buffer limit exceeded", e.getMessage());
} }
} }
}
@Test @Test
public void testHeapWithEstimatedSize() throws IOException { public void testHeapWithEstimatedSize() throws IOException {

Loading…
Cancel
Save