Search in sources :

Example 16 with SchemaResult

use of io.confluent.ksql.schema.ksql.inference.TopicSchemaSupplier.SchemaResult in project ksql by confluentinc.

the class SchemaRegistryTopicSchemaSupplierTest method shouldReturnErrorFromGetValueWithIdSchemaIfNotFound.

@Test
public void shouldReturnErrorFromGetValueWithIdSchemaIfNotFound() throws Exception {
    // Given:
    when(srClient.getSchemaBySubjectAndId(any(), anyInt())).thenThrow(notFoundException());
    // When:
    final SchemaResult result = supplier.getValueSchema(Optional.of(TOPIC_NAME), Optional.of(42), expectedFormat, SerdeFeatures.of());
    // Then:
    assertThat(result.schemaAndId, is(Optional.empty()));
    assertThat(result.failureReason, is(not(Optional.empty())));
    verifyFailureMessageForValue(result, Optional.of(42));
}
Also used : SchemaResult(io.confluent.ksql.schema.ksql.inference.TopicSchemaSupplier.SchemaResult) Test(org.junit.Test)

Aggregations

SchemaResult (io.confluent.ksql.schema.ksql.inference.TopicSchemaSupplier.SchemaResult)16 Test (org.junit.Test)16 ImmutableList (com.google.common.collect.ImmutableList)1 ParsedSchema (io.confluent.kafka.schemaregistry.ParsedSchema)1 AvroSchema (io.confluent.kafka.schemaregistry.avro.AvroSchema)1 SchemaMetadata (io.confluent.kafka.schemaregistry.client.SchemaMetadata)1 SchemaRegistryClient (io.confluent.kafka.schemaregistry.client.SchemaRegistryClient)1 RestClientException (io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException)1 ProtobufSchema (io.confluent.kafka.schemaregistry.protobuf.ProtobufSchema)1 SimpleColumn (io.confluent.ksql.schema.ksql.SimpleColumn)1 Format (io.confluent.ksql.serde.Format)1 FormatInfo (io.confluent.ksql.serde.FormatInfo)1 SchemaTranslator (io.confluent.ksql.serde.SchemaTranslator)1 SerdeFeature (io.confluent.ksql.serde.SerdeFeature)1 SerdeFeatures (io.confluent.ksql.serde.SerdeFeatures)1 KsqlException (io.confluent.ksql.util.KsqlException)1 IOException (java.io.IOException)1 Map (java.util.Map)1 Optional (java.util.Optional)1 HttpStatus (org.apache.http.HttpStatus)1