cadonna commented on code in PR #12492:
URL: https://github.com/apache/kafka/pull/12492#discussion_r946788936


##########
streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamFlatTransformValuesTest.java:
##########
@@ -68,69 +72,60 @@ public void 
shouldTransformInputRecordToMultipleOutputValues() {
                 "Hello",
                 "Blue",
                 "Planet");
+
         processor.init(context);
-        EasyMock.reset(valueTransformer);
 
-        EasyMock.expect(valueTransformer.transform(inputKey, 
inputValue)).andReturn(outputValues);
-        for (final String outputValue : outputValues) {
-            context.forward(new Record<>(inputKey, outputValue, 0L));
-        }
-        replayAll();
+        when(valueTransformer.transform(inputKey, 
inputValue)).thenReturn(outputValues);
 
         processor.process(new Record<>(inputKey, inputValue, 0L));
 
-        verifyAll();
+        for (final String outputValue : outputValues) {
+            verify(context).forward(new Record<>(inputKey, outputValue, 0L));
+        }
     }
 
     @Test
     public void shouldEmitNoRecordIfTransformReturnsEmptyList() {
         processor.init(context);
-        EasyMock.reset(valueTransformer);
 
-        EasyMock.expect(valueTransformer.transform(inputKey, 
inputValue)).andReturn(Collections.emptyList());
-        replayAll();
+        when(valueTransformer.transform(inputKey, 
inputValue)).thenReturn(Collections.emptyList());
 
         processor.process(new Record<>(inputKey, inputValue, 0L));
 
-        verifyAll();
+        verify(context, never()).forward(ArgumentMatchers.<Record<Integer, 
String>>any());
     }
 
     @Test
     public void shouldEmitNoRecordIfTransformReturnsNull() {
         processor.init(context);
-        EasyMock.reset(valueTransformer);
 
-        EasyMock.expect(valueTransformer.transform(inputKey, 
inputValue)).andReturn(null);
-        replayAll();
+        when(valueTransformer.transform(inputKey, 
inputValue)).thenReturn(null);
 
         processor.process(new Record<>(inputKey, inputValue, 0L));
 
-        verifyAll();
+        verify(context, never()).forward(ArgumentMatchers.<Record<Integer, 
String>>any());
     }
 
     @Test
     public void shouldCloseFlatTransformValuesProcessor() {
-        valueTransformer.close();
-        replayAll();
-
         processor.close();
 
-        verifyAll();
+        verify(valueTransformer).close();
     }
 
     @Test
     public void shouldGetFlatTransformValuesProcessor() {
+        @SuppressWarnings("unchecked")
         final ValueTransformerWithKeySupplier<Integer, Integer, 
Iterable<String>> valueTransformerSupplier =
             mock(ValueTransformerWithKeySupplier.class);
         final KStreamFlatTransformValues<Integer, Integer, String> 
processorSupplier =
             new KStreamFlatTransformValues<>(valueTransformerSupplier);
 
-        
EasyMock.expect(valueTransformerSupplier.get()).andReturn(valueTransformer);
-        replayAll();
+        when(valueTransformerSupplier.get()).thenReturn(valueTransformer);
 
         final Processor<Integer, Integer, Integer, String> processor = 
processorSupplier.get();
 
-        verifyAll();
+        verify(valueTransformerSupplier).get();

Review Comment:
   I think it does so, because you could have stubbings in the setup method for 
the test class. If only some test methods use those stubbings, you would get 
failures if you run a single test that does not use the those stubbings.



-- 
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]

Reply via email to