UUIDSerde implements Serde<UUID> { public byte[] toBytes(UUID obj) { if (obj != null) { return ByteBuffer.allocate(16) .putLong(obj.getMostSignificantBits()) .putLong(obj.getLeastSignificantBits()) .array(); } else { return null; } }  byte[] toBytes(UUID obj); UUID fromBytes(byte[] bytes);  }
@Test public void testToBytesWhenNull() { assertNull(serde.toBytes(null)); }