wuchong commented on a change in pull request #15197: URL: https://github.com/apache/flink/pull/15197#discussion_r595881912
########## File path: flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliClientITCase.java ########## @@ -150,22 +160,63 @@ public void testSqlStatements() throws IOException { // ------------------------------------------------------------------------------------------- private static final String PROMOTE = "Flink SQL> "; - private static final String INFO_BEGIN = "\u001B[34;1m"; - private static final String INFO_END = "\u001B[0m"; - private static final String ERROR_BEGIN = "\u001B[31;1m"; - private static final String ERROR_END = "\u001B[0m"; + + enum Tag { + ERROR("\u001B[31;1m", "\u001B[0m", "!error"), + + WARNING("\u001B[33;1m", "\u001B[0m", "!warning"), + + INFO("\u001B[34;1m", "\u001B[0m", "!info"), + + OK("", "", "!ok"); + + public final String begin; + public final String end; + public final String tag; + + Tag(String begin, String end, String tag) { + this.begin = begin; + this.end = end; + this.tag = tag; + } + + public boolean onMatch(List<String> lines) { + return containsTag(lines, begin) && containsTag(lines, end); + } + + public List<String> matches(List<String> lines) { Review comment: This should be `onMatch`, or we can call it `convert` or `transform`. ########## File path: flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliClientITCase.java ########## @@ -150,22 +160,63 @@ public void testSqlStatements() throws IOException { // ------------------------------------------------------------------------------------------- private static final String PROMOTE = "Flink SQL> "; - private static final String INFO_BEGIN = "\u001B[34;1m"; - private static final String INFO_END = "\u001B[0m"; - private static final String ERROR_BEGIN = "\u001B[31;1m"; - private static final String ERROR_END = "\u001B[0m"; + + enum Tag { + ERROR("\u001B[31;1m", "\u001B[0m", "!error"), + + WARNING("\u001B[33;1m", "\u001B[0m", "!warning"), + + INFO("\u001B[34;1m", "\u001B[0m", "!info"), + + OK("", "", "!ok"); + + public final String begin; + public final String end; + public final String tag; + + Tag(String begin, String end, String tag) { + this.begin = begin; + this.end = end; + this.tag = tag; + } + + public boolean onMatch(List<String> lines) { Review comment: this method should be `matches`. ---------------------------------------------------------------- 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: us...@infra.apache.org