### Question:
SafeSerdes { public static Serde<UUID> UUID() { final Serde<UUID> serde = Serdes.UUID(); return new Serdes.WrapperSerde<>( serde.serializer(), new SafeDeserializer<>(serde.deserializer(), UUID.class) ); }  static Serde<T> serdeFrom(final Serde<T> serde, final T defaultValue); static Serde<T> serdeFrom(final Serializer<T> serializer,
                                         final Deserializer<T> deserializer,
                                         final T defaultValue); static Serde<T> serdeFrom(final Class<T> type, final T defaultValue); static Serde<String> String(); static Serde<String> String(final String defaultValue); static Serde<Long> Long(); static Serde<Long> Long(final Long defaultValue); static Serde<Double> Double(); static Serde<Double> Double(final Double defaultValue); static Serde<Integer> Integer(); static Serde<Float> Float(); static Serde<Float> Float(final Float defaultValue); static Serde<UUID> UUID(); static Serde<UUID> UUID(final UUID uuid);  }### Answer:
@Test public void shouldSafelyDeserializeUUIDValueGivenDefaultObject() { final UUID defaultUUID = UUID.randomUUID(); final Serde<UUID> serde = SafeSerdes.UUID(defaultUUID); final Deserializer<UUID> deserializer = serde.deserializer(); final Serializer<UUID> serializer = serde.serializer(); Assertions.assertEquals(defaultUUID, deserializer.deserialize(TOPIC, CORRUPTED_RECORD)); UUID uuid = UUID.randomUUID(); Assertions.assertEquals(uuid, deserializer.deserialize(TOPIC, serializer.serialize(TOPIC, uuid))); }
@Test public void shouldSafelyDeserializeUUIDValueGivenConfiguredObject() { final UUID defaultUUID = UUID.randomUUID(); final Serde<UUID> serde = SafeSerdes.UUID(); serde.configure(new HashMap<>(){{ put(SafeDeserializerConfig.SAFE_DESERIALIZER_DEFAULT_VALUE_CONFIG, defaultUUID.toString()); }}, false); final Deserializer<UUID> deserializer = serde.deserializer(); final Serializer<UUID> serializer = serde.serializer(); Assertions.assertEquals(defaultUUID, deserializer.deserialize(TOPIC, CORRUPTED_RECORD)); UUID uuid = UUID.randomUUID(); Assertions.assertEquals(uuid, deserializer.deserialize(TOPIC, serializer.serialize(TOPIC, uuid))); }