public class TemporaryBufferTest {
@Test
public void testEmpty() throws IOException {
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
try {
b.close();
@Test
public void testOneByte() throws IOException {
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
final byte test = (byte) new TestRng(getName()).nextInt();
try {
@Test
public void testOneBlock_BulkWrite() throws IOException {
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
final byte[] test = new TestRng(getName())
.nextBytes(TemporaryBuffer.Block.SZ);
@Test
public void testOneBlockAndHalf_BulkWrite() throws IOException {
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
final byte[] test = new TestRng(getName())
.nextBytes(TemporaryBuffer.Block.SZ * 3 / 2);
@Test
public void testOneBlockAndHalf_SingleWrite() throws IOException {
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
final byte[] test = new TestRng(getName())
.nextBytes(TemporaryBuffer.Block.SZ * 3 / 2);
@Test
public void testOneBlockAndHalf_Copy() throws IOException {
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
final byte[] test = new TestRng(getName())
.nextBytes(TemporaryBuffer.Block.SZ * 3 / 2);
@Test
public void testLarge_SingleWrite() throws IOException {
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
final byte[] test = new TestRng(getName())
.nextBytes(TemporaryBuffer.DEFAULT_IN_CORE_LIMIT * 3);
@Test
public void testInCoreLimit_SwitchOnAppendByte() throws IOException {
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
final byte[] test = new TestRng(getName())
.nextBytes(TemporaryBuffer.DEFAULT_IN_CORE_LIMIT + 1);
@Test
public void testInCoreLimit_SwitchBeforeAppendByte() throws IOException {
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
final byte[] test = new TestRng(getName())
.nextBytes(TemporaryBuffer.DEFAULT_IN_CORE_LIMIT * 3);
@Test
public void testInCoreLimit_SwitchOnCopy() throws IOException {
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
final byte[] test = new TestRng(getName())
.nextBytes(TemporaryBuffer.DEFAULT_IN_CORE_LIMIT * 2);
@Test
public void testDestroyWhileOpen() throws IOException {
- @SuppressWarnings("resource" /* java 7 */)
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
try {
b.write(new TestRng(getName())
@Test
public void testRandomWrites() throws IOException {
+ @SuppressWarnings("resource") // Buffer is explicitly destroyed in finally block
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(null);
final TestRng rng = new TestRng(getName());
final int max = TemporaryBuffer.DEFAULT_IN_CORE_LIMIT * 2;