2323import org .junit .rules .ExpectedException ;
2424import org .junit .runner .RunWith ;
2525
26+ import android .test .suitebuilder .annotation .SmallTest ;
2627import android .util .Log ;
2728
2829import java .io .File ;
3839import static org .hamcrest .Matchers .is ;
3940import static org .junit .Assert .assertThat ;
4041
42+ @ SmallTest
4143@ RunWith (Theories .class )
4244public class DirectBufferTest
4345{
@@ -77,7 +79,7 @@ public class DirectBufferTest
7779 @ DataPoint
7880 public static final DirectBuffer MEMORY_MAPPED_BUFFER = new DirectBuffer (createMemoryMappedBuffer ());
7981
80- // private static long memoryBlockAddress = BitUtil.getUnsafe().allocateMemory(BUFFER_CAPACITY) ;
82+ // private static long memoryBlockAddress = 0 ;
8183
8284 // @DataPoint //not valid for android
8385 // public static final DirectBuffer OFF_HEAP_BUFFER =
@@ -521,14 +523,12 @@ public void shouldPutDirectBytesToBufferTruncate(final DirectBuffer buffer)
521523
522524 private static RandomAccessFile memoryMappedFile ;
523525 private static MappedByteBuffer buffer ;
524- private static File tempFile ;
525526
526527 private static ByteBuffer createMemoryMappedBuffer ()
527528 {
528529 try
529530 {
530- tempFile = File .createTempFile ("tempDirectBufferTest" , ".tmp" );
531- tempFile .deleteOnExit ();
531+ File tempFile = new File ("/dev/zero" );
532532 memoryMappedFile = new RandomAccessFile (tempFile , "rw" );
533533 buffer = memoryMappedFile .getChannel ().map (FileChannel .MapMode .READ_WRITE , 0 , BUFFER_CAPACITY );
534534 return buffer ;
@@ -553,7 +553,6 @@ public static void cleanup()
553553 cleanMethod .invoke (buffer );
554554
555555 memoryMappedFile .close ();
556- tempFile .delete ();
557556 }
558557 catch (Exception e )
559558 {
0 commit comments