### Question:
JsonFriendlyRecord { public static JsonFriendlyRecord fromKinesisClientRecord(@NonNull final KinesisClientRecord record) { byte[] data; if (record.data() == null) { data = null; } else if (record.data().hasArray()) { data = record.data().array(); } else { data = new byte[record.data().limit()]; record.data().get(data); } Long approximateArrival = record.approximateArrivalTimestamp() == null ? null : record.approximateArrivalTimestamp().toEpochMilli(); return new JsonFriendlyRecord(data, record.partitionKey(), record.sequenceNumber(), approximateArrival, record.subSequenceNumber()); }  static JsonFriendlyRecord fromKinesisClientRecord(@NonNull final KinesisClientRecord record); @JsonProperty String getAction(); static String ACTION; }### Answer:
@Test public void testRecordHandlesNullData() { kinesisClientRecord = defaultRecord().data(null).build(); JsonFriendlyRecord jsonFriendlyRecord = JsonFriendlyRecord.fromKinesisClientRecord(kinesisClientRecord); assertThat(jsonFriendlyRecord, equivalentTo(kinesisClientRecord)); }
@Test public void testRecordHandlesNoByteArrayBuffer() { byte[] expected = new byte[] { 1, 2, 3, 4 }; ByteBuffer expectedBuffer = ByteBuffer.allocateDirect(expected.length); expectedBuffer.put(expected); expectedBuffer.rewind(); kinesisClientRecord = defaultRecord().data(expectedBuffer).build(); JsonFriendlyRecord jsonFriendlyRecord = JsonFriendlyRecord.fromKinesisClientRecord(kinesisClientRecord); expectedBuffer.rewind(); assertThat(jsonFriendlyRecord, equivalentTo(kinesisClientRecord)); }
@Test public void testRecordHandlesArrayByteBuffer() { ByteBuffer expected = ByteBuffer.wrap(new byte[] { 1, 2, 3, 4 }); kinesisClientRecord = defaultRecord().data(expected).build(); JsonFriendlyRecord jsonFriendlyRecord = JsonFriendlyRecord.fromKinesisClientRecord(kinesisClientRecord); assertThat(jsonFriendlyRecord, equivalentTo(kinesisClientRecord)); }