On Sat, 8 Jun 2024 07:07:41 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

>> Possibly. It means updating 15 tests. Also need to come up with a new name. 
>> Any suggestions?
>
> Hello Chris, given these similary named methods in this class, perhaps we 
> should instead just have one single `stderrShouldBeEmptyIgnoring(...)` method 
> which takes the messages that should be ignored. Something like:
> 
> 
> public static final String VM_WARNING_MSG = ".* VM warning:.*";
> 
> public static final String VM_WARNING_DEPRECATED_MSG = ".* VM warning:.* 
> deprecated.*";
> ...
> 
> public OutputAnalyzer stderrShouldBeEmptyIgnoring(String ignoreMsg, String... 
> additionalIgnoreMsgs) {
>     String stdErrContent = getStderr().replaceAll(ignoreMsg + "\\R", "");
>     if (additionalIgnoreMsgs != null) {
>       for (String additionalIgnore : additionalIgnoreMsgs) {
>               stdErrContent = stdErrContent.replaceAll(additionalIgnore + 
> "\\R", "");
>       }
>     }
>     if (!stdErrContent.isEmpty()) {
>       reportDiagnosticSummary();
>       throw new RuntimeException("stderr was not empty");
>     }
>     return this;
> }
> 
> 
> We make those private fields in OutputAnalyzer public and have the caller 
> pass them:
> 
> 
> oa.stderrShouldBeEmptyIgnoring(OutputAnalyzer.VM_WARNING_DEPRECATED_MSG)

That seems like a lot of busy work and over abstraction for trying to solve a 
rather trivial issue that already has a very simple solution, but maybe could 
use a better API name.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19606#discussion_r1631928608

Reply via email to