FrankYang0529 commented on code in PR #16254: URL: https://github.com/apache/kafka/pull/16254#discussion_r1637632275
########## streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamSlidingWindowAggregateTest.java: ########## @@ -87,48 +85,45 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; -@RunWith(Parameterized.class) public class KStreamSlidingWindowAggregateTest { - - @Parameterized.Parameters(name = "{0}_inorder:{1}_cache:{2}") - public static Collection<Object[]> data() { - return Arrays.asList(new Object[][] { - {StrategyType.ON_WINDOW_UPDATE, true, true}, - {StrategyType.ON_WINDOW_UPDATE, true, false}, - {StrategyType.ON_WINDOW_UPDATE, false, true}, - {StrategyType.ON_WINDOW_UPDATE, false, false}, - {StrategyType.ON_WINDOW_CLOSE, true, true}, - {StrategyType.ON_WINDOW_CLOSE, true, false}, - {StrategyType.ON_WINDOW_CLOSE, false, true}, - {StrategyType.ON_WINDOW_CLOSE, false, false} - }); + + public static Stream<Arguments> data() { + return Stream.of( + Arguments.of(StrategyType.ON_WINDOW_UPDATE, true, true), + Arguments.of(StrategyType.ON_WINDOW_UPDATE, true, false), + Arguments.of(StrategyType.ON_WINDOW_UPDATE, false, true), + Arguments.of(StrategyType.ON_WINDOW_UPDATE, false, false), + Arguments.of(StrategyType.ON_WINDOW_CLOSE, true, true), + Arguments.of(StrategyType.ON_WINDOW_CLOSE, true, false), + Arguments.of(StrategyType.ON_WINDOW_CLOSE, false, true), + Arguments.of(StrategyType.ON_WINDOW_CLOSE, false, false) + ); } - @Parameter public StrategyType type; - - @Parameter(1) public boolean inOrderIterator; - - @Parameter(2) public boolean withCache; private boolean emitFinal; private EmitStrategy emitStrategy; private final Properties props = StreamsTestUtils.getStreamsConfig(Serdes.String(), Serdes.String()); private final String threadId = Thread.currentThread().getName(); - - @Before - public void before() { + + public void setup(final StrategyType inputType, final boolean inputInOrderIterator, final boolean inputWithCache) { + type = inputType; + inOrderIterator = inputInOrderIterator; + withCache = inputWithCache; emitFinal = type.equals(StrategyType.ON_WINDOW_CLOSE); emitStrategy = StrategyType.forType(type); } - @Test - public void testAggregateSmallInput() { + @ParameterizedTest + @MethodSource("data") Review Comment: This one can't just use `@EnumSource(EmitStrategy.StrategyType.class)`, because there are another two arguments. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org