Search in sources :

Example 1 with Time

use of org.apache.kafka.connect.data.Time in project ksql by confluentinc.

the class KsqlJsonDeserializerTest method shouldThrowIfCanNotCoerceToTime.

@Test
public void shouldThrowIfCanNotCoerceToTime() {
    // Given:
    final KsqlJsonDeserializer<java.sql.Time> deserializer = givenDeserializerForSchema(Time.SCHEMA, java.sql.Time.class);
    final byte[] bytes = serializeJson(BooleanNode.valueOf(true));
    // When:
    final Exception e = assertThrows(SerializationException.class, () -> deserializer.deserialize(SOME_TOPIC, bytes));
    // Then:
    assertThat(e.getCause(), (hasMessage(startsWith("Can't convert type. sourceType: BooleanNode, requiredType: TIME"))));
}
Also used : Time(org.apache.kafka.connect.data.Time) SerializationException(org.apache.kafka.common.errors.SerializationException) KsqlException(io.confluent.ksql.util.KsqlException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 KsqlException (io.confluent.ksql.util.KsqlException)1 IOException (java.io.IOException)1 SerializationException (org.apache.kafka.common.errors.SerializationException)1 Time (org.apache.kafka.connect.data.Time)1 Test (org.junit.Test)1