@ -61,6 +61,7 @@ import org.junit.Test;
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 ( ) ;
@ -75,6 +76,7 @@ public class TemporaryBufferTest {
@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 {
@ -100,6 +102,7 @@ public class TemporaryBufferTest {
@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 ) ;
@ -129,6 +132,7 @@ public class TemporaryBufferTest {
@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 ) ;
@ -158,6 +162,7 @@ public class TemporaryBufferTest {
@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 ) ;
@ -185,6 +190,7 @@ public class TemporaryBufferTest {
@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 ) ;
@ -213,6 +219,7 @@ public class TemporaryBufferTest {
@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 ) ;
@ -252,6 +259,7 @@ public class TemporaryBufferTest {
@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 ) ;
@ -279,6 +287,7 @@ public class TemporaryBufferTest {
@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 ) ;
@ -306,6 +315,7 @@ public class TemporaryBufferTest {
@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 ) ;
@ -336,7 +346,7 @@ public class TemporaryBufferTest {
@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 ( ) )
@ -348,6 +358,7 @@ public class TemporaryBufferTest {
@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 ;