ijuma commented on a change in pull request #10852: URL: https://github.com/apache/kafka/pull/10852#discussion_r650040685
########## File path: log4j-appender/src/test/java/org/apache/kafka/log4jappender/KafkaLog4jAppenderTest.java ########## @@ -158,18 +160,18 @@ public void testRealProducerConfigWithSyncSendAndNotIgnoringExceptionsShouldThro assertThrows(RuntimeException.class, () -> logger.error(getMessage(0))); } + @SuppressWarnings("unchecked") Review comment: Can we have the suppression at the variable level like it is in the example you mentioned? ########## File path: log4j-appender/src/test/java/org/apache/kafka/log4jappender/KafkaLog4jAppenderTest.java ########## @@ -158,18 +160,18 @@ public void testRealProducerConfigWithSyncSendAndNotIgnoringExceptionsShouldThro assertThrows(RuntimeException.class, () -> logger.error(getMessage(0))); } + @SuppressWarnings("unchecked") Review comment: No, it's still best to do it at the most specific place in my opinion. ########## File path: log4j-appender/src/test/java/org/apache/kafka/log4jappender/KafkaLog4jAppenderTest.java ########## @@ -159,17 +161,18 @@ public void testRealProducerConfigWithSyncSendAndNotIgnoringExceptionsShouldThro } private void replaceProducerWithMocked(MockKafkaLog4jAppender mockKafkaLog4jAppender, boolean success) { - MockProducer<byte[], byte[]> producer = EasyMock.niceMock(MockProducer.class); - Future<RecordMetadata> futureMock = EasyMock.niceMock(Future.class); + @SuppressWarnings("unchecked") + MockProducer<byte[], byte[]> producer = mock(MockProducer.class); + @SuppressWarnings("unchecked") + Future<RecordMetadata> futureMock = mock(Future.class); try { if (!success) - EasyMock.expect(futureMock.get()) - .andThrow(new ExecutionException("simulated timeout", new TimeoutException())); + when(futureMock.get()) + .thenThrow(new ExecutionException("simulated timeout", new TimeoutException())); } catch (InterruptedException | ExecutionException e) { Review comment: That's a good point. -- 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