use of org.apache.kafka.common.config.ConfigException in project kafka by apache.
the class ListSerializerTest method testListValueSerializerShouldThrowConfigExceptionDueAlreadyInitialized.
@Test
public void testListValueSerializerShouldThrowConfigExceptionDueAlreadyInitialized() {
props.put(CommonClientConfigs.DEFAULT_LIST_VALUE_SERDE_INNER_CLASS, Serdes.StringSerde.class);
final ListSerializer<Integer> initializedListSerializer = new ListSerializer<>(Serdes.Integer().serializer());
final ConfigException exception = assertThrows(ConfigException.class, () -> initializedListSerializer.configure(props, false));
assertEquals("List serializer was already initialized using a non-default constructor", exception.getMessage());
}
use of org.apache.kafka.common.config.ConfigException in project kafka by apache.
the class ListDeserializerTest method testListValueDeserializerNoArgConstructorsShouldThrowConfigExceptionDueMissingTypeClassProp.
@Test
public void testListValueDeserializerNoArgConstructorsShouldThrowConfigExceptionDueMissingTypeClassProp() {
props.put(CommonClientConfigs.DEFAULT_LIST_VALUE_SERDE_INNER_CLASS, Serdes.StringSerde.class);
final ConfigException exception = assertThrows(ConfigException.class, () -> listDeserializer.configure(props, false));
assertEquals("Not able to determine the list class because " + "it was neither passed via the constructor nor set in the config.", exception.getMessage());
}
use of org.apache.kafka.common.config.ConfigException in project kafka by apache.
the class ListDeserializerTest method testListValueDeserializerShouldThrowConfigExceptionDueAlreadyInitialized.
@Test
public void testListValueDeserializerShouldThrowConfigExceptionDueAlreadyInitialized() {
props.put(CommonClientConfigs.DEFAULT_LIST_VALUE_SERDE_TYPE_CLASS, ArrayList.class);
props.put(CommonClientConfigs.DEFAULT_LIST_VALUE_SERDE_INNER_CLASS, Serdes.StringSerde.class);
final ListDeserializer<Integer> initializedListDeserializer = new ListDeserializer<>(ArrayList.class, Serdes.Integer().deserializer());
final ConfigException exception = assertThrows(ConfigException.class, () -> initializedListDeserializer.configure(props, true));
assertEquals("List deserializer was already initialized using a non-default constructor", exception.getMessage());
}
use of org.apache.kafka.common.config.ConfigException in project kafka by apache.
the class ListDeserializerTest method testListKeyDeserializerShouldThrowConfigExceptionDueAlreadyInitialized.
@Test
public void testListKeyDeserializerShouldThrowConfigExceptionDueAlreadyInitialized() {
props.put(CommonClientConfigs.DEFAULT_LIST_KEY_SERDE_TYPE_CLASS, ArrayList.class);
props.put(CommonClientConfigs.DEFAULT_LIST_KEY_SERDE_INNER_CLASS, Serdes.StringSerde.class);
final ListDeserializer<Integer> initializedListDeserializer = new ListDeserializer<>(ArrayList.class, Serdes.Integer().deserializer());
final ConfigException exception = assertThrows(ConfigException.class, () -> initializedListDeserializer.configure(props, true));
assertEquals("List deserializer was already initialized using a non-default constructor", exception.getMessage());
}
use of org.apache.kafka.common.config.ConfigException in project kafka by apache.
the class ListDeserializerTest method testListValueDeserializerNoArgConstructorsShouldThrowConfigExceptionDueMissingInnerClassProp.
@Test
public void testListValueDeserializerNoArgConstructorsShouldThrowConfigExceptionDueMissingInnerClassProp() {
props.put(CommonClientConfigs.DEFAULT_LIST_VALUE_SERDE_TYPE_CLASS, ArrayList.class);
final ConfigException exception = assertThrows(ConfigException.class, () -> listDeserializer.configure(props, false));
assertEquals("Not able to determine the inner serde class because " + "it was neither passed via the constructor nor set in the config.", exception.getMessage());
}
Aggregations