cadonna commented on a change in pull request #9273: URL: https://github.com/apache/kafka/pull/9273#discussion_r501802252
########## File path: streams/src/test/java/org/apache/kafka/streams/KafkaStreamsTest.java ########## @@ -617,7 +619,19 @@ public void shouldThrowExceptionSettingUncaughtExceptionHandlerNotInCreateState( final KafkaStreams streams = new KafkaStreams(getBuilderWithSource().build(), props, supplier, time); streams.start(); try { - streams.setUncaughtExceptionHandler(null); + streams.setUncaughtExceptionHandler((Thread.UncaughtExceptionHandler) null); + fail("Should throw IllegalStateException"); + } catch (final IllegalStateException e) { + // expected + } + } Review comment: Sorry, my bad! It doesn't matter whether it is called or not, since the `IllegalStateException` is thrown. ########## File path: streams/src/test/java/org/apache/kafka/streams/KafkaStreamsTest.java ########## @@ -617,7 +619,19 @@ public void shouldThrowExceptionSettingUncaughtExceptionHandlerNotInCreateState( final KafkaStreams streams = new KafkaStreams(getBuilderWithSource().build(), props, supplier, time); streams.start(); try { - streams.setUncaughtExceptionHandler(null); + streams.setUncaughtExceptionHandler((Thread.UncaughtExceptionHandler) null); + fail("Should throw IllegalStateException"); + } catch (final IllegalStateException e) { + // expected + } + } + + @Test + public void shouldThrowExceptionSettingStreamsUncaughtExceptionHandlerNotInCreateState() { Review comment: Actually, there are two tests missing. With the test you added, you test the `else` branch on line 400 in `KafkaStreams`. But you do not test the `then` branch of the same `if` statement and within the `then` branch there are again a `then` branch and a `else` branch to test. If you do without the inner `else` branch as I proposed in another comment, you need to test the exception that is thrown when `null` is passed to the method. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org