This is an automated email from the ASF dual-hosted git repository.
olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/master by this push:
new 60dd20523 fix: handle log decoration for log parsing (#3562)
60dd20523 is described below
commit 60dd20523a1ca5e4d06a2cf9d18adcb50b6bde25
Author: Sebastian Tiemann <[email protected]>
AuthorDate: Mon Nov 2 11:56:03 2026 +0100
fix: handle log decoration for log parsing (#3562)
Signed-off-by: Sebastian Tiemann <[email protected]>
---
.../Surefire1082ParallelJUnit4ParameterizedIT.java | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git
a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1082ParallelJUnit4ParameterizedIT.java
b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1082ParallelJUnit4ParameterizedIT.java
index 359f1f021..c11491f97 100644
---
a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1082ParallelJUnit4ParameterizedIT.java
+++
b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1082ParallelJUnit4ParameterizedIT.java
@@ -31,7 +31,6 @@
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.maven.surefire.its.fixture.IsRegex.regex;
-import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.AnyOf.anyOf;
import static org.hamcrest.core.Is.is;
@@ -43,6 +42,9 @@
* @since 2.18
*/
public class Surefire1082ParallelJUnit4ParameterizedIT extends
SurefireJUnit4IntegrationTestCase {
+
+ private static final String LOG_DECORATION = "[INFO] [stdout] ";
+
private static Set<String> printOnlyTestLinesFromOutFile(OutputValidator
validator) {
TestFile report =
validator.getSurefireReportsFile("jiras.surefire1082.Jira1082Test-output.txt");
report.assertFileExists();
@@ -52,6 +54,7 @@ private static Set<String>
printOnlyTestLinesFromOutFile(OutputValidator validat
private static Set<String> printOnlyTestLines(Collection<String> logs) {
Set<String> log = new TreeSet<>();
for (String line : logs) {
+ line = removeLogDecoration(line);
if (line.startsWith("class jiras.surefire1082.")) {
log.add(line);
}
@@ -60,13 +63,14 @@ private static Set<String>
printOnlyTestLines(Collection<String> logs) {
}
private static void assertParallelRun(Set<String> log) {
+
assertThat(log.size(), is(4));
Set<String> expectedLogs1 = new TreeSet<>();
- expectedLogs1.add("class jiras.surefire1082.Jira1082Test a 0
ForkJoinPool.*");
- expectedLogs1.add("class jiras.surefire1082.Jira1082Test b 0
ForkJoinPool.*");
- expectedLogs1.add("class jiras.surefire1082.Jira1082Test a 1
ForkJoinPool.*");
- expectedLogs1.add("class jiras.surefire1082.Jira1082Test b 1
ForkJoinPool.*");
+ expectedLogs1.add(".*class jiras.surefire1082.Jira1082Test a 0
ForkJoinPool.*");
+ expectedLogs1.add(".*class jiras.surefire1082.Jira1082Test b 0
ForkJoinPool.*");
+ expectedLogs1.add(".*class jiras.surefire1082.Jira1082Test a 1
ForkJoinPool.*");
+ expectedLogs1.add(".*class jiras.surefire1082.Jira1082Test b 1
ForkJoinPool.*");
Set<String> expectedLogs2 = new TreeSet<>();
expectedLogs2.add("class jiras.surefire1082.Jira1082Test a 1
ForkJoinPool.*");
@@ -91,7 +95,7 @@ public void checkClassesRunParallel() throws
VerificationException {
validator.assertThatLogLine(containsString("Running
jiras.surefire1082.Jira1082Test"), is(1));
- Set<String> log = new
TreeSet<>(validator.loadLogLines(startsWith("class jiras.surefire1082.")));
+ Set<String> log = new
TreeSet<>(validator.loadLogLines(containsString("class jiras.surefire1082.")));
assertParallelRun(log);
}
@@ -117,4 +121,8 @@ public void checkOutFileClassesRunParallel() throws
VerificationException {
private SurefireLauncher unpack() {
return unpack("surefire-1082-parallel-junit-parameterized");
}
+
+ private static String removeLogDecoration(String line) {
+ return line.replace(LOG_DECORATION, "");
+ }
}