Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void test() {}
}

@Test
public void testAfterAllFailuresAreReported() throws IOException {
public void testAfterAllFailuresAreReported() throws IOException, ParserConfigurationException, SAXException {
causeFailure.set(true);

// First let's do a sanity test that we have the expected failures for the @AfterAll
Expand Down Expand Up @@ -102,9 +102,19 @@ public void testAfterAllFailuresAreReported() throws IOException {
"<failure message=\"I always fail.\" type=\"java.lang.RuntimeException\">", "failures=\"1\"",
};


Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(xmlFile);
document.getDocumentElement().normalize();

// Useful for debugging the expected output
// System.out.println(Files.readString(xmlFile.toPath()));

Element testsuite = (Element) document.getDocumentElement().getElementsByTagName("testsuite").item(0);
assertEquals("1", testsuite.getAttribute("tests")); // expected 1 but is 2

// expected 1 but is 2
assertEquals(2, testsuite.getElementsByTagName("testcase").getLength());

for (String expected : expectedStrings) {
assertTrue(
Files.lines(xmlFile.toPath()).anyMatch(line -> line.contains(expected)),
Expand Down