use of org.apache.kafka.connect.data.SchemaAndValue in project kafka by apache.
the class JsonConverterTest method timeToConnectOptionalWithDefaultValue.
@Test
public void timeToConnectOptionalWithDefaultValue() {
java.util.Date reference = new java.util.Date(0);
Schema schema = Time.builder().optional().defaultValue(reference).schema();
String msg = "{ \"schema\": { \"type\": \"int32\", \"name\": \"org.apache.kafka.connect.data.Time\", \"version\": 1, \"optional\": true, \"default\": 0 }, \"payload\": null }";
SchemaAndValue schemaAndValue = converter.toConnectData(TOPIC, msg.getBytes());
assertEquals(schema, schemaAndValue.schema());
assertEquals(reference, schemaAndValue.value());
}
Aggregations