elharo commented on code in PR #790: URL: https://github.com/apache/maven-surefire/pull/790#discussion_r1802043542
########## maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java: ########## @@ -64,6 +69,49 @@ public void testSkipped() throws Exception { writeReadCheck(new RunResult(3, 2, 1, 0, null, true)); } + @Test + public void testFlakes() throws Exception { Review Comment: can you be more specific about the exception thrown? ########## maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java: ########## @@ -64,6 +69,49 @@ public void testSkipped() throws Exception { writeReadCheck(new RunResult(3, 2, 1, 0, null, true)); } + @Test + public void testFlakes() throws Exception { + writeReadCheck(new RunResult(3, 2, 1, 0, 2, null, true)); + } + + @Test + public void testLegacyDeserialization() throws Exception { Review Comment: can you be more specific about the exception thrown? ########## maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java: ########## @@ -64,6 +69,49 @@ public void testSkipped() throws Exception { writeReadCheck(new RunResult(3, 2, 1, 0, null, true)); } + @Test + public void testFlakes() throws Exception { + writeReadCheck(new RunResult(3, 2, 1, 0, 2, null, true)); + } + + @Test + public void testLegacyDeserialization() throws Exception { + File legacySummary = SureFireFileManager.createTempFile("failsafe", "test"); + String legacyFailsafeSummaryXmlTemplate = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + + "<failsafe-summary xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + + " xsi:noNamespaceSchemaLocation=\"https://maven.apache.org/surefire/maven-surefire-plugin/xsd/failsafe-summary.xsd\"" + + " result=\"%s\" timeout=\"%s\">\n" + + " <completed>%d</completed>\n" + + " <errors>%d</errors>\n" + + " <failures>%d</failures>\n" + + " <skipped>%d</skipped>\n" + + " %s\n" + + "</failsafe-summary>"; + String xml = format(Locale.ROOT, legacyFailsafeSummaryXmlTemplate, 0, false, 3, 2, 1, 0, "msg"); + Files.write( + legacySummary.toPath(), + xml.getBytes(StandardCharsets.UTF_8), + StandardOpenOption.CREATE, + StandardOpenOption.TRUNCATE_EXISTING, + StandardOpenOption.WRITE); + + // When the failsafe-summary.xml does not contain the <flakes> element, it should be considered as 0. + RunResult expected = new RunResult(3, 2, 1, 0, 0, null, false); + RunResult actual = FailsafeSummaryXmlUtils.toRunResult(legacySummary); + + assertThat(actual.getCompletedCount()).isEqualTo(expected.getCompletedCount()); Review Comment: assertEquals is simpler and more obvious -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org