11/*
2- * Copyright (c) 2013, 2023 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2013, 2024 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -665,7 +665,7 @@ public OutputAnalyzer shouldBeEmptyIgnoreVMWarnings() {
665665
666666 /**
667667 * Verify that the stderr contents of output buffer matches the pattern,
668- * after filtering out the Hotespot warning messages
668+ * after filtering out the Hotspot warning messages
669669 *
670670 * @param pattern
671671 * @throws RuntimeException If the pattern was not found
@@ -681,6 +681,24 @@ public OutputAnalyzer stderrShouldMatchIgnoreVMWarnings(String pattern) {
681681 return this ;
682682 }
683683
684+ /**
685+ * Verify that the stderr contents of output buffer matches the pattern,
686+ * after filtering out the Hotspot deprecation warning messages
687+ *
688+ * @param pattern
689+ * @throws RuntimeException If the pattern was not found
690+ */
691+ public OutputAnalyzer stderrShouldMatchIgnoreDeprecatedWarnings (String pattern ) {
692+ String stderr = getStderr ().replaceAll (deprecatedmsg + "\\ R" , "" );
693+ Matcher matcher = Pattern .compile (pattern , Pattern .MULTILINE ).matcher (stderr );
694+ if (!matcher .find ()) {
695+ reportDiagnosticSummary ();
696+ throw new RuntimeException ("'" + pattern
697+ + "' missing from stderr" );
698+ }
699+ return this ;
700+ }
701+
684702 /**
685703 * Returns the contents of the output buffer (stdout and stderr), without those
686704 * JVM warning msgs, as list of strings. Output is split by newlines.
0 commit comments