You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/06/14 07:10:23 UTC

[GitHub] [kafka] dengziming commented on a change in pull request #10852: MINOR: Replace easymock with mockito in log4j-appender

dengziming commented on a change in pull request #10852:
URL: https://github.com/apache/kafka/pull/10852#discussion_r649629620



##########
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:
       Because Mockito.mock() returns `MockProducer` but we need `MockProducer<byte[], byte[]>`, this is similar to https://github.com/apache/kafka/blob/5936a249bda171851cfa669da4276d23230eab6e/raft/src/test/java/org/apache/kafka/raft/internals/MemoryBatchReaderTest.java#L46 

##########
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:
       Because Mockito.mock() returns `MockProducer` but we need `MockProducer<byte[], byte[]>`, this is similar to https://github.com/apache/kafka/blob/5936a249bda171851cfa669da4276d23230eab6e/raft/src/test/java/org/apache/kafka/raft/internals/MemoryBatchReaderTest.java#L45

##########
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:
       We have 2 variables here that need to be suppressed, `futureMock` and `producer`, so it seems better to suppress them at the method level, WDYT?




-- 
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:
users@infra.apache.org