JacksonCborFactory implements CborFactory { @Override public ByteBuffer toByteBuffer(final JsonValue jsonValue) throws IOException { return ByteBuffer.wrap(toByteArray(jsonValue)); } JacksonCborFactory(); @Override boolean isCborAvailable(); @Override JsonValue readFrom(final byte[] bytes); @Override JsonValue readFrom(final byte[] bytes, final int offset, final int length); @Override JsonValue readFrom(final ByteBuffer byteBuffer); @Override byte[] toByteArray(final JsonValue jsonValue); @Override ByteBuffer toByteBuffer(final JsonValue jsonValue); @Override void writeToByteBuffer(final JsonValue jsonValue, final ByteBuffer byteBuffer); @Override byte[] createCborRepresentation(final Map<String, JsonField> jsonFieldMap, final int guessedSerializedSize); @Override byte[] createCborRepresentation(final List<JsonValue> list, final int guessedSerializedSize);  }
@Test public void toBytebufferWorks() throws IOException { Assertions.assertThat(BinaryToHexConverter.toHexString(cborFactory.toByteBuffer(testValue))) .isEqualTo(CborTestUtils.serializeToHexString(testValue)); }