Search in sources :

Example 1 with DeserializationError

use of io.confluent.ksql.logging.processing.DeserializationError in project ksql by confluentinc.

the class StaticTopicSerdeTest method shouldLogOriginalFailureIfBothFail.

@Test
public void shouldLogOriginalFailureIfBothFail() {
    // Given:
    when(delegateD.deserialize(Mockito.any(), Mockito.any())).thenThrow(new RuntimeException());
    final ProcessingLogger logger = mock(ProcessingLogger.class);
    final LoggingDeserializer<Object> loggingDelegate = new LoggingDeserializer<>(delegateD, logger);
    final Serde<Object> delegate = new WrapperSerde<>(delegateS, loggingDelegate);
    staticSerde = StaticTopicSerde.wrap(STATIC_TOPIC, delegate, callback);
    // When:
    final RuntimeException err = assertThrows(RuntimeException.class, () -> staticSerde.deserializer().deserialize(SOURCE_TOPIC, SOME_BYTES));
    // Then:
    verify(logger).error(new DeserializationError(err, Optional.of(SOME_BYTES), STATIC_TOPIC, false));
    verifyNoMoreInteractions(callback);
}
Also used : ProcessingLogger(io.confluent.ksql.logging.processing.ProcessingLogger) WrapperSerde(org.apache.kafka.common.serialization.Serdes.WrapperSerde) LoggingDeserializer(io.confluent.ksql.logging.processing.LoggingDeserializer) DeserializationError(io.confluent.ksql.logging.processing.DeserializationError) Test(org.junit.Test)

Aggregations

DeserializationError (io.confluent.ksql.logging.processing.DeserializationError)1 LoggingDeserializer (io.confluent.ksql.logging.processing.LoggingDeserializer)1 ProcessingLogger (io.confluent.ksql.logging.processing.ProcessingLogger)1 WrapperSerde (org.apache.kafka.common.serialization.Serdes.WrapperSerde)1 Test (org.junit.Test)1