chia7712 commented on code in PR #17767:
URL: https://github.com/apache/kafka/pull/17767#discussion_r1847779105
##########
core/src/test/java/kafka/admin/UserScramCredentialsCommandTest.java:
##########
@@ -25,6 +25,8 @@
import org.junit.jupiter.api.extension.ExtendWith;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Review Comment:
Could you please move `UserScramCredentialsCommandTest` to tools module too?
##########
core/src/test/java/kafka/admin/UserScramCredentialsCommandTest.java:
##########
@@ -184,4 +186,25 @@ private static String updateUserMessage(String user) {
private static String quotaMessage(String user) {
return "Quota configs for user-principal '" + user + "' are
consumer_byte_rate=20000.0";
}
+
+ private String captureStandardStream(boolean isErr, Runnable runnable) {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ PrintStream currentStream = isErr ? System.err : System.out;
+ PrintStream tempStream = new PrintStream(outputStream);
+ if (isErr)
+ System.setErr(tempStream);
+ else
+ System.setOut(tempStream);
+ try {
Review Comment:
After moving this to tools module, we don't need to have this duplicate
method. It can be replaced by `ToolsTestUtils#captureStandardStream`
--
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]