m1a2st commented on code in PR #19570:
URL: https://github.com/apache/kafka/pull/19570#discussion_r2061398527
##########
streams/src/test/java/org/apache/kafka/streams/kstream/TimeWindowedDeserializerTest.java:
##########
@@ -97,34 +104,41 @@ public void
shouldThrowErrorIfWindowSizeSetInConstructorConfigAndConstructor() {
assertThrows(IllegalArgumentException.class, () ->
timeWindowedDeserializer.configure(props, false));
}
+ @Deprecated
@Test
public void
shouldThrowErrorIfWindowSizeIsNotSetAndWindowedInnerClassSerdeIsSet() {
props.put(StreamsConfig.WINDOWED_INNER_CLASS_SERDE,
Serdes.ByteArraySerde.class.getName());
- final TimeWindowedDeserializer<?> deserializer = new
TimeWindowedDeserializer<>();
- assertThrows(IllegalArgumentException.class, () ->
deserializer.configure(props, false));
+ try (final TimeWindowedDeserializer<?> deserializer = new
TimeWindowedDeserializer<>()) {
+ assertThrows(IllegalArgumentException.class, () ->
deserializer.configure(props, false));
+ }
}
@Test
public void
shouldThrowErrorIfWindowSizeIsNotSetAndWindowedInnerDeserializerClassIsSet() {
- props.put(TimeWindowedDeserializer.WINDOW_SIZE_MS_CONFIG,
Serdes.ByteArraySerde.class.getName());
- final TimeWindowedDeserializer<?> deserializer = new
TimeWindowedDeserializer<>();
- assertThrows(IllegalArgumentException.class, () ->
deserializer.configure(props, false));
+ props.put(TimeWindowedDeserializer.WINDOWED_INNER_DESERIALIZER_CLASS,
Serdes.ByteArraySerde.class.getName());
Review Comment:
How about using `assertThrowsExactly` to ensure that only the expected
exception type is thrown, without allowing subclasses?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]