chia7712 commented on code in PR #15862: URL: https://github.com/apache/kafka/pull/15862#discussion_r1615991000
########## core/src/test/java/kafka/test/junit/ClusterTestExtensionsUnitTest.java: ########## @@ -17,29 +17,66 @@ package kafka.test.junit; +import kafka.test.ClusterConfig; import kafka.test.annotation.ClusterTemplate; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.extension.ExtensionContext; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class ClusterTestExtensionsUnitTest { + + static class StubTest { Review Comment: It seems this nested class is unnecessary. For example: ```java static List<ClusterConfig> cfgEmpty() { return new ArrayList<ClusterConfig>(); } @SuppressWarnings({"unchecked", "rawtypes"}) private ExtensionContext buildExtensionContext(String methodName) throws Exception { ExtensionContext extensionContext = mock(ExtensionContext.class); Class clazz = ClusterTestExtensionsUnitTest.class; Method method = clazz.getDeclaredMethod(methodName); when(extensionContext.getRequiredTestClass()).thenReturn(clazz); when(extensionContext.getRequiredTestMethod()).thenReturn(method); return extensionContext; } ``` BTW, `methodName` is always "cfgEmpty", so maybe we can remove it from input argument. -- 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