Skip to content

Commit bd7a3d9

Browse files
committed
[Android] Added test annotations
1 parent a6997d6 commit bd7a3d9

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

test/android/uk/co/real_logic/sbe/codec/java/CodecUtilTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717

1818
import org.junit.Test;
1919

20+
import android.test.suitebuilder.annotation.SmallTest;
21+
2022
import java.nio.ByteOrder;
2123

2224
import static org.hamcrest.Matchers.is;
2325
import static org.junit.Assert.assertFalse;
2426
import static org.junit.Assert.assertThat;
2527
import static org.junit.Assert.assertTrue;
2628

29+
@SmallTest
2730
public class CodecUtilTest
2831
{
2932
private static final ByteOrder BYTE_ORDER = ByteOrder.nativeOrder();

test/android/uk/co/real_logic/sbe/codec/java/DirectBufferTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.junit.rules.ExpectedException;
2424
import org.junit.runner.RunWith;
2525

26+
import android.test.suitebuilder.annotation.SmallTest;
2627
import android.util.Log;
2728

2829
import java.io.File;
@@ -38,6 +39,7 @@
3839
import static org.hamcrest.Matchers.is;
3940
import static org.junit.Assert.assertThat;
4041

42+
@SmallTest
4143
@RunWith(Theories.class)
4244
public 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

Comments
 (0)