Skip to content

Commit

Permalink
Correction to test library change
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjwalls committed Sep 6, 2024
1 parent 1f7f76f commit a373cc6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/lib/jdk/test/lib/process/OutputAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ public OutputAnalyzer stderrShouldBeEmptyIgnoreWarnings() {
* If stderr was not empty
*/
public OutputAnalyzer stderrShouldBeEmptyIgnoreDeprecatedWarnings() {
if (!getStderr().replaceAll(VM_DEPRECATED_MSG + "\\R", "").isEmpty() &&
!getStderr().replaceAll(OTHER_DEPRECATED_MSG + "\\R", "").isEmpty()) {
if (!getStderrNoDeprecatedWarnings().isEmpty()) {
reportDiagnosticSummary();
throw new RuntimeException("stderr was not empty");
}
Expand Down Expand Up @@ -605,6 +604,15 @@ public String getStderr() {
return buffer.getStderr();
}

/**
* Get the contents of the stderr buffer, with known deprecation warning patterns removed
*
* @return stderr buffer, with known deprecation warnings removed
*/
public String getStderrNoDeprecatedWarnings() {
return getStderr().replaceAll(VM_DEPRECATED_MSG + "\\R", "").replaceAll(OTHER_DEPRECATED_MSG + "\\R", "");
}

/**
* Get the process exit value
*
Expand Down Expand Up @@ -691,8 +699,7 @@ public OutputAnalyzer stderrShouldMatchIgnoreVMWarnings(String pattern) {
* @throws RuntimeException If the pattern was not found
*/
public OutputAnalyzer stderrShouldMatchIgnoreDeprecatedWarnings(String pattern) {
String stderr = getStderr().replaceAll(VM_DEPRECATED_MSG + "\\R", "");
stderr = stderr.replaceAll(OTHER_DEPRECATED_MSG + "\\R", "");
String stderr = getStderrNoDeprecatedWarnings();
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
if (!matcher.find()) {
reportDiagnosticSummary();
Expand Down

0 comments on commit a373cc6

Please sign in to comment.