Skip to content

Commit 08455ec

Browse files
committed
[Java] Allocate a heap buffer rather than a direct buffer in tests.
1 parent e0f83c6 commit 08455ec

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

sbe-tool/src/test/java/uk/co/real_logic/sbe/generation/java/CompositeElementsGenerationTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class CompositeElementsGenerationTest
6060
@Test
6161
public void shouldEncodeCorrectly()
6262
{
63-
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocateDirect(MSG_BUFFER_CAPACITY);
63+
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocate(MSG_BUFFER_CAPACITY);
6464
encodeTestMessage(encodedMsgBuffer);
6565

6666
final DirectBuffer decodeBuffer = new UnsafeBuffer(encodedMsgBuffer);
@@ -96,7 +96,7 @@ public void shouldEncodeCorrectly()
9696
@Test
9797
public void shouldDecodeCorrectly()
9898
{
99-
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocateDirect(MSG_BUFFER_CAPACITY);
99+
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocate(MSG_BUFFER_CAPACITY);
100100
encodeTestMessage(encodedMsgBuffer);
101101

102102
final DirectBuffer decodeBuffer = new UnsafeBuffer(encodedMsgBuffer);
@@ -126,7 +126,7 @@ public void shouldDecodeCorrectly()
126126
@Test
127127
public void shouldDisplayCorrectly()
128128
{
129-
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocateDirect(MSG_BUFFER_CAPACITY);
129+
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocate(MSG_BUFFER_CAPACITY);
130130
encodeTestMessage(encodedMsgBuffer);
131131

132132
final String compositeString = MSG_ENCODER.structure().toString();
@@ -139,10 +139,10 @@ public void shouldDisplayCorrectly()
139139
@Test
140140
public void shouldOtfDecodeCorrectly() throws Exception
141141
{
142-
final ByteBuffer encodedSchemaBuffer = ByteBuffer.allocateDirect(SCHEMA_BUFFER_CAPACITY);
142+
final ByteBuffer encodedSchemaBuffer = ByteBuffer.allocate(SCHEMA_BUFFER_CAPACITY);
143143
encodeSchema(encodedSchemaBuffer);
144144

145-
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocateDirect(MSG_BUFFER_CAPACITY);
145+
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocate(MSG_BUFFER_CAPACITY);
146146
encodeTestMessage(encodedMsgBuffer);
147147

148148

sbe-tool/src/test/java/uk/co/real_logic/sbe/generation/java/ToStringTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class ToStringTest extends EncodedCarTestBase
1515
@Test
1616
public void exampleMessagePrinted() throws Exception
1717
{
18-
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocateDirect(MSG_BUFFER_CAPACITY);
18+
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocate(MSG_BUFFER_CAPACITY);
1919
encodeTestMessage(encodedMsgBuffer);
2020

2121
final String result = CAR.toString();
@@ -41,7 +41,7 @@ public void exampleMessagePrinted() throws Exception
4141
@Test
4242
public void emptyMessagePrinted() throws Exception
4343
{
44-
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocateDirect(MSG_BUFFER_CAPACITY);
44+
final ByteBuffer encodedMsgBuffer = ByteBuffer.allocate(MSG_BUFFER_CAPACITY);
4545
CAR.wrap(new UnsafeBuffer(encodedMsgBuffer), 0);
4646

4747
final String result = CAR.toString();

0 commit comments

Comments
 (0)