On Sat, 8 Jun 2024 07:17:55 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

>> 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.

In that case, would `stderrShouldBeEmptyIgnoreVMOptionDeprecations` be OK?

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

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

Reply via email to