Skip to content

Commit c55b21a

Browse files
laeubimarcphilipp
andauthored
Update platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java
Co-authored-by: Marc Philipp <[email protected]>
1 parent e89a20e commit c55b21a

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,49 @@ void writesXmlReportToSocket(@TempDir Path tempDirectory) throws Exception {
357357
assertThat(serverThread.join(Duration.ofSeconds(10))).isTrue();
358358

359359
// Verify XML was received
360-
assertThat(builder.toString()) //
361-
.isNotNull() //
362-
.contains("<e:events") //
363-
.contains("dummy") //
364-
.contains("Test 1");
360+
var expected = """
361+
<e:events xmlns="https://schemas.opentest4j.org/reporting/core/0.2.0"
362+
xmlns:e="https://schemas.opentest4j.org/reporting/events/0.2.0"
363+
xmlns:git="https://schemas.opentest4j.org/reporting/git/0.2.0"
364+
xmlns:java="https://schemas.opentest4j.org/reporting/java/0.2.0"
365+
xmlns:junit="https://schemas.junit.org/open-test-reporting"
366+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
367+
xsi:schemaLocation="https://schemas.junit.org/open-test-reporting https://schemas.junit.org/open-test-reporting/junit-1.9.xsd">
368+
<infrastructure>
369+
<hostName>${xmlunit.ignore}</hostName>
370+
<userName>${xmlunit.ignore}</userName>
371+
<operatingSystem>${xmlunit.ignore}</operatingSystem>
372+
<cpuCores>${xmlunit.ignore}</cpuCores>
373+
<java:javaVersion>${xmlunit.ignore}</java:javaVersion>
374+
<java:fileEncoding>${xmlunit.ignore}</java:fileEncoding>
375+
<java:heapSize max="${xmlunit.isNumber}"/>
376+
</infrastructure>
377+
<e:started id="1" name="dummy" time="${xmlunit.isDateTime}">
378+
<metadata>
379+
<junit:uniqueId>[engine:dummy]</junit:uniqueId>
380+
<junit:legacyReportingName>dummy</junit:legacyReportingName>
381+
<junit:type>CONTAINER</junit:type>
382+
</metadata>
383+
</e:started>
384+
<e:started id="2" name="Test 1" parentId="1" time="${xmlunit.isDateTime}">
385+
<metadata>
386+
<junit:uniqueId>[engine:dummy]/[test:test1]</junit:uniqueId>
387+
<junit:legacyReportingName>Test 1</junit:legacyReportingName>
388+
<junit:type>TEST</junit:type>
389+
</metadata>
390+
</e:started>
391+
<e:finished id="2" time="${xmlunit.isDateTime}">
392+
<result status="SUCCESSFUL"/>
393+
</e:finished>
394+
<e:finished id="1" time="${xmlunit.isDateTime}">
395+
<result status="SUCCESSFUL"/>
396+
</e:finished>
397+
</e:events>
398+
""";
399+
XmlAssert.assertThat(builder.toString()).and(expected) //
400+
.withDifferenceEvaluator(new PlaceholderDifferenceEvaluator()) //
401+
.ignoreWhitespace() //
402+
.areIdentical();
365403
}
366404
}
367405

0 commit comments

Comments
 (0)