Skip to content

Commit 3f43a57

Browse files
committed
use direct buffer
1 parent 884c2b7 commit 3f43a57

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

services-directions-models/src/test/java/com/mapbox/api/directions/v5/models/DirectionsResponseTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ public void fromJson_correctlyBuildsFromJson() throws Exception {
8787

8888
@Test
8989
public void deserialization_from_byte_buffer() throws Exception {
90-
String json = loadJsonFixture(DIRECTIONS_V5_PRECISION6_FIXTURE);
91-
ByteBuffer buffer = ByteBuffer.wrap(json.getBytes(StandardCharsets.UTF_8));
90+
byte[] json = loadJsonFixture(DIRECTIONS_V5_PRECISION6_FIXTURE).getBytes(StandardCharsets.UTF_8);
91+
ByteBuffer buffer = ByteBuffer.allocateDirect(json.length);
92+
buffer.put(json);
93+
buffer.position(0);
9294
DirectionsResponse response = DirectionsResponse.fromJson(buffer, StandardCharsets.UTF_8);
9395
assertNotNull(response);
9496
assertEquals(1, response.routes().size());

0 commit comments

Comments
 (0)