You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2018/01/01 14:50:37 UTC
maven-surefire git commit: [SUREFIRE-1416] maven-surefire-parser: add
new method isError in ReportTestCase [Forced Update!]
Repository: maven-surefire
Updated Branches:
refs/heads/SUREFIRE-1416 e59560688 -> 869d6f29f (forced update)
[SUREFIRE-1416] maven-surefire-parser: add new method isError in ReportTestCase
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/869d6f29
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/869d6f29
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/869d6f29
Branch: refs/heads/SUREFIRE-1416
Commit: 869d6f29ff81bf2116a118f8118b63f21de4aa8a
Parents: 9826145
Author: Tibor17 <ti...@apache.org>
Authored: Wed Dec 27 10:53:00 2017 +0100
Committer: Tibor17 <ti...@apache.org>
Committed: Thu Dec 28 01:18:45 2017 +0100
----------------------------------------------------------------------
.../surefire/report/StatelessXmlReporter.java | 6 +-
.../report/SurefireReportGenerator.java | 66 +++++++++++++-------
.../surefire/report/Surefire597Test.java | 3 +-
.../Surefire260TestWithIdenticalNamesIT.java | 7 ++-
.../plugins/surefire/report/ReportTestCase.java | 53 +++++++++++++---
.../surefire/report/ReportTestSuite.java | 10 +--
.../surefire/report/SurefireReportParser.java | 14 ++---
.../surefire/report/TestSuiteXmlParser.java | 6 +-
.../report/SurefireReportParserTest.java | 6 +-
.../surefire/report/TestSuiteXmlParserTest.java | 21 +++++--
10 files changed, 125 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/869d6f29/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
index 7a7681f..533e1ca 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
@@ -392,9 +392,9 @@ public class StatelessXmlReporter
{
if ( t.getMessage() != null )
{
- ppw.addAttribute( "type", ( stackTrace.contains( ":" )
- ? stackTrace.substring( 0, stackTrace.indexOf( ":" ) )
- : stackTrace ) );
+ int delimiter = stackTrace.indexOf( ":" );
+ String type = delimiter == -1 ? stackTrace : stackTrace.substring( 0, delimiter );
+ ppw.addAttribute( "type", type );
}
else
{
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/869d6f29/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
index a06c25e..530398c 100644
--- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
+++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
@@ -35,6 +35,7 @@ import org.apache.maven.reporting.MavenReportException;
import static org.apache.maven.doxia.markup.HtmlMarkup.A;
import static org.apache.maven.doxia.sink.Sink.JUSTIFY_LEFT;
import static org.apache.maven.doxia.sink.SinkEventAttributes.CLASS;
+import static org.apache.maven.doxia.sink.SinkEventAttributes.HREF;
import static org.apache.maven.doxia.sink.SinkEventAttributes.ID;
import static org.apache.maven.doxia.sink.SinkEventAttributes.NAME;
import static org.apache.maven.doxia.sink.SinkEventAttributes.STYLE;
@@ -398,7 +399,7 @@ public final class SurefireReportGenerator
{
List<ReportTestCase> testCases = suite.getTestCases();
- if ( testCases != null && !testCases.isEmpty() )
+ if ( !testCases.isEmpty() )
{
sink.section2();
sink.sectionTitle2();
@@ -411,7 +412,7 @@ public final class SurefireReportGenerator
for ( ReportTestCase testCase : testCases )
{
- if ( testCase.hasFailure() || showSuccess )
+ if ( !testCase.isSuccessful() || showSuccess )
{
showTable = true;
@@ -427,7 +428,7 @@ public final class SurefireReportGenerator
for ( ReportTestCase testCase : testCases )
{
- if ( testCase.hasFailure() || showSuccess )
+ if ( !testCase.isSuccessful() || showSuccess )
{
constructTestCaseSection( sink, numberFormat, testCase );
}
@@ -468,7 +469,7 @@ public final class SurefireReportGenerator
sink.tableCell_();
- if ( testCase.hasFailure() )
+ if ( !testCase.isSuccessful() )
{
sink.tableCell();
@@ -481,24 +482,24 @@ public final class SurefireReportGenerator
atts.addAttribute( STYLE, "display:inline" );
sink.unknown( "div", TAG_TYPE_START, atts );
- sink.link( "javascript:toggleDisplay('" + toHtmlId( testCase.getFullName() ) + "');" );
+ sinkLink( sink, "javascript:toggleDisplay('" + toHtmlId( testCase.getFullName() ) + "');" );
atts = new SinkEventAttributeSet();
atts.addAttribute( STYLE, "display:inline;" );
- atts.addAttribute( ID, toHtmlId( testCase.getFullName() ) + "off" );
+ atts.addAttribute( ID, toHtmlId( testCase.getFullName() ) + "-off" );
sink.unknown( "span", TAG_TYPE_START, atts );
sink.text( " + " );
sink.unknown( "span", TAG_TYPE_END, null );
atts = new SinkEventAttributeSet();
atts.addAttribute( STYLE, "display:none;" );
- atts.addAttribute( ID, toHtmlId( testCase.getFullName() ) + "on" );
+ atts.addAttribute( ID, toHtmlId( testCase.getFullName() ) + "-on" );
sink.unknown( "span", TAG_TYPE_START, atts );
sink.text( " - " );
sink.unknown( "span", TAG_TYPE_END, null );
sink.text( "[ Detail ]" );
- sink.link_();
+ sinkLink_( sink );
sink.unknown( "div", TAG_TYPE_END, null );
@@ -513,7 +514,7 @@ public final class SurefireReportGenerator
sink.tableRow_();
- if ( testCase.hasFailure() )
+ if ( !testCase.isSuccessful() )
{
sink.tableRow();
@@ -530,7 +531,7 @@ public final class SurefireReportGenerator
sink.tableCell();
SinkEventAttributeSet atts = new SinkEventAttributeSet();
- atts.addAttribute( ID, toHtmlId( testCase.getFullName() ) + "error" );
+ atts.addAttribute( ID, toHtmlId( testCase.getFullName() ) + toHtmlIdFailure( testCase ) );
atts.addAttribute( STYLE, "display:none;" );
sink.unknown( "div", TAG_TYPE_START, atts );
@@ -605,7 +606,7 @@ public final class SurefireReportGenerator
sink.tableCell();
SinkEventAttributeSet atts = new SinkEventAttributeSet();
- atts.addAttribute( ID, tCase.getName() + "error" );
+ atts.addAttribute( ID, tCase.getName() + toHtmlIdFailure( tCase ) );
sink.unknown( "div", TAG_TYPE_START, atts );
String fullClassName = tCase.getFullClassName();
@@ -660,7 +661,12 @@ public final class SurefireReportGenerator
}
}
- private void sinkLineBreak( Sink sink )
+ private static String toHtmlIdFailure( ReportTestCase tCase )
+ {
+ return tCase.hasError() ? "-error" : "-failure";
+ }
+
+ private static void sinkLineBreak( Sink sink )
{
sink.lineBreak();
}
@@ -729,6 +735,19 @@ public final class SurefireReportGenerator
sink.unknown( A.toString(), TAG_TYPE_END, null );
}
+ private static void sinkLink( Sink sink, String href )
+ {
+ // The "'" argument in this JavaScript function would be escaped to "'"
+ // sink.link( "javascript:toggleDisplay('" + toHtmlId( testCase.getFullName() ) + "');" );
+ sink.unknown( A.toString(), TAG_TYPE_START, new SinkEventAttributeSet( HREF, href ) );
+ }
+
+ @SuppressWarnings( "checkstyle:methodname" )
+ private static void sinkLink_( Sink sink )
+ {
+ sink.unknown( A.toString(), TAG_TYPE_END, null );
+ }
+
private static String javascriptToggleDisplayCode()
{
@@ -736,17 +755,20 @@ public final class SurefireReportGenerator
// so we have to start with a newline and comment the CDATA closing in the end
return "\n" + "function toggleDisplay(elementId) {\n"
- + " var elm = document.getElementById(elementId + 'error');\n"
+ + " var elm = document.getElementById(elementId + '-error');\n"
+ + " if (elm == null) {\n"
+ + " elm = document.getElementById(elementId + '-failure');\n"
+ + " }\n"
+ " if (elm && typeof elm.style != \"undefined\") {\n"
- + " if (elm.style.display == \"none\") {\n"
- + " elm.style.display = \"\";\n"
- + " document.getElementById(elementId + 'off').style.display = \"none\";\n"
- + " document.getElementById(elementId + 'on').style.display = \"inline\";\n"
- + " }" + " else if (elm.style.display == \"\") {"
- + " elm.style.display = \"none\";\n"
- + " document.getElementById(elementId + 'off').style.display = \"inline\";\n"
- + " document.getElementById(elementId + 'on').style.display = \"none\";\n"
- + " } \n"
+ + " if (elm.style.display == \"none\") {\n"
+ + " elm.style.display = \"\";\n"
+ + " document.getElementById(elementId + '-off').style.display = \"none\";\n"
+ + " document.getElementById(elementId + '-on').style.display = \"inline\";\n"
+ + " } else if (elm.style.display == \"\") {"
+ + " elm.style.display = \"none\";\n"
+ + " document.getElementById(elementId + '-off').style.display = \"inline\";\n"
+ + " document.getElementById(elementId + '-on').style.display = \"none\";\n"
+ + " } \n"
+ " } \n"
+ " }\n"
+ "//";
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/869d6f29/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
index 31c5fd4..4d75a30 100644
--- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
+++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
@@ -118,7 +118,6 @@ public class Surefire597Test
+ "<tr class=\"a\">\n"
+ "<td></td>\n"
+ "<td>\n"
- + "<div id=\"testerror\">surefire.MyTest:13</div></td></tr></table>" ) ) );
-
+ + "<div id=\"test-error\">surefire.MyTest:13</div></td></tr></table>" ) ) );
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/869d6f29/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java
index 5f59eac..aab3380 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java
@@ -31,6 +31,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/**
@@ -59,8 +60,10 @@ public class Surefire260TestWithIdenticalNamesIT
final HtmlPage page = webClient.getPage( uri.toURL() );
final HtmlAnchor a =
- (HtmlAnchor) page.getByXPath( "//a[@href = \"javascript:toggleDisplay('surefire260.TestB.testDup');\"]" ).get( 0 );
- final HtmlDivision content = (HtmlDivision) page.getElementById( "surefire260.TestB.testDuperror" );
+ (HtmlAnchor) page.getByXPath( "//a[@href = \"javascript:toggleDisplay('surefire260.TestB.testDup');\"]" )
+ .get( 0 );
+ final HtmlDivision content = (HtmlDivision) page.getElementById( "surefire260.TestB.testDup-failure" );
+ assertNotNull( content );
assertTrue( content.getAttribute( "style" ).contains( "none" ) );
a.click();
assertFalse( content.getAttribute( "style" ).contains( "none" ) );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/869d6f29/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java
----------------------------------------------------------------------
diff --git a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java
index cd94afd..bd1429b 100644
--- a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java
+++ b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java
@@ -19,7 +19,7 @@ package org.apache.maven.plugins.surefire.report;
* under the License.
*/
-import org.apache.maven.shared.utils.StringUtils;
+import static org.apache.maven.shared.utils.StringUtils.isNotBlank;
/**
*
@@ -46,6 +46,10 @@ public final class ReportTestCase
private boolean hasFailure;
+ private boolean hasError;
+
+ private boolean hasSkipped;
+
public String getName()
{
return name;
@@ -117,12 +121,6 @@ public final class ReportTestCase
return failureType;
}
- private ReportTestCase setFailureType( String failureType )
- {
- this.failureType = failureType;
- return this;
- }
-
public String getFailureErrorLine()
{
return failureErrorLine;
@@ -147,15 +145,48 @@ public final class ReportTestCase
public ReportTestCase setFailure( String message, String type )
{
- hasFailure = StringUtils.isNotBlank( type );
+ hasFailure = isNotBlank( type );
+ hasError = false;
+ hasSkipped = false;
return setFailureMessage( message ).setFailureType( type );
}
+ public ReportTestCase setError( String message, String type )
+ {
+ hasFailure = false;
+ hasError = isNotBlank( type );
+ hasSkipped = false;
+ return setFailureMessage( message ).setFailureType( type );
+ }
+
+ public ReportTestCase setSkipped( String message )
+ {
+ hasFailure = false;
+ hasError = false;
+ hasSkipped = isNotBlank( message );
+ return setFailureMessage( message ).setFailureType( "skipped" );
+ }
+
+ public boolean isSuccessful()
+ {
+ return !hasFailure() && !hasError() && !hasSkipped();
+ }
+
public boolean hasFailure()
{
return hasFailure;
}
+ public boolean hasError()
+ {
+ return hasError;
+ }
+
+ public boolean hasSkipped()
+ {
+ return hasSkipped;
+ }
+
/**
* {@inheritDoc}
*/
@@ -164,4 +195,10 @@ public final class ReportTestCase
{
return fullName;
}
+
+ private ReportTestCase setFailureType( String failureType )
+ {
+ this.failureType = failureType;
+ return this;
+ }
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/869d6f29/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestSuite.java
----------------------------------------------------------------------
diff --git a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestSuite.java b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestSuite.java
index 76420ba..20a9456 100644
--- a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestSuite.java
+++ b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestSuite.java
@@ -122,15 +122,7 @@ public final class ReportTestSuite
public int getNumberOfTests()
{
- if ( numberOfTests != null )
- {
- return numberOfTests;
- }
- if ( testCases != null )
- {
- return testCases.size();
- }
- return 0;
+ return numberOfTests == null ? testCases.size() : numberOfTests;
}
public ReportTestSuite setNumberOfTests( int numberOfTests )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/869d6f29/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
----------------------------------------------------------------------
diff --git a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
index 62240e5..7eba4ac 100644
--- a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
+++ b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
@@ -204,24 +204,20 @@ public final class SurefireReportParser
public List<ReportTestCase> getFailureDetails( List<ReportTestSuite> testSuites )
{
- List<ReportTestCase> failureDetailList = new ArrayList<ReportTestCase>();
+ List<ReportTestCase> failureDetails = new ArrayList<ReportTestCase>();
for ( ReportTestSuite suite : testSuites )
{
- List<ReportTestCase> testCases = suite.getTestCases();
- if ( testCases != null )
+ for ( ReportTestCase tCase : suite.getTestCases() )
{
- for ( ReportTestCase tCase : testCases )
+ if ( !tCase.isSuccessful() )
{
- if ( tCase.hasFailure() )
- {
- failureDetailList.add( tCase );
- }
+ failureDetails.add( tCase );
}
}
}
- return failureDetailList;
+ return failureDetails;
}
/**
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/869d6f29/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
----------------------------------------------------------------------
diff --git a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
index 0d48e98..721106e 100644
--- a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
+++ b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
@@ -197,13 +197,13 @@ public final class TestSuiteXmlParser
}
else if ( "error".equals( qName ) )
{
- testCase.setFailure( attributes.getValue( "message" ), attributes.getValue( "type" ) );
+ testCase.setError( attributes.getValue( "message" ), attributes.getValue( "type" ) );
currentSuite.incrementNumberOfErrors();
}
else if ( "skipped".equals( qName ) )
{
- final String message = attributes.getValue( "message" );
- testCase.setFailure( message != null ? message : "skipped", "skipped" );
+ String message = attributes.getValue( "message" );
+ testCase.setSkipped( message != null ? message : "skipped" );
currentSuite.incrementNumberOfSkipped();
}
else if ( "flakyFailure".equals( qName ) || "flakyError".equals( qName ) )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/869d6f29/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
----------------------------------------------------------------------
diff --git a/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java b/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
index bfd9d49..5de439d 100644
--- a/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
+++ b/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
@@ -57,7 +57,7 @@ public class SurefireReportParserTest
public void testParseXMLReportFiles()
throws MavenReportException, UnsupportedEncodingException
{
- report.setReportsDirectory( getTestDir( "/test-reports" ) );
+ report.setReportsDirectory( getTestDir() );
List<ReportTestSuite> suites = report.parseXMLReportFiles();
@@ -71,10 +71,10 @@ public class SurefireReportParserTest
}
}
- private File getTestDir( String path )
+ private File getTestDir()
throws UnsupportedEncodingException
{
- URL resource = getClass().getResource( path );
+ URL resource = getClass().getResource( "/test-reports" );
// URLDecoder.decode necessary for JDK 1.5+, where spaces are escaped to %20
return new File( URLDecoder.decode( resource.getPath(), "UTF-8" ) ).getAbsoluteFile();
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/869d6f29/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParserTest.java
----------------------------------------------------------------------
diff --git a/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParserTest.java b/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParserTest.java
index 96b428f..9c336b6 100644
--- a/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParserTest.java
+++ b/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParserTest.java
@@ -188,6 +188,7 @@ public class TestSuiteXmlParserTest
assertThat( tests.get( 0 ).getFailureMessage(), is( "<" ) );
assertThat( tests.get( 0 ).getFullName(), is( "wellFormedXmlFailures.TestSurefire3.testLower" ) );
assertThat( tests.get( 0 ).getFailureType(), is( "junit.framework.AssertionFailedError" ) );
+ assertThat( tests.get( 0 ).hasError(), is( false ) );
assertThat( tests.get( 1 ).getFullClassName(), is( "wellFormedXmlFailures.TestSurefire3" ) );
assertThat( tests.get( 1 ).getName(), is( "testU0000" ) );
@@ -201,6 +202,7 @@ public class TestSuiteXmlParserTest
assertThat( tests.get( 1 ).getFailureMessage(), is( "&0#;" ) );
assertThat( tests.get( 1 ).getFullName(), is( "wellFormedXmlFailures.TestSurefire3.testU0000" ) );
assertThat( tests.get( 1 ).getFailureType(), is( "junit.framework.AssertionFailedError" ) );
+ assertThat( tests.get( 1 ).hasError(), is( false ) );
assertThat( tests.get( 2 ).getFullClassName(), is( "wellFormedXmlFailures.TestSurefire3" ) );
assertThat( tests.get( 2 ).getName(), is( "testGreater" ) );
@@ -214,6 +216,7 @@ public class TestSuiteXmlParserTest
assertThat( tests.get( 2 ).getFailureMessage(), is( ">" ) );
assertThat( tests.get( 2 ).getFullName(), is( "wellFormedXmlFailures.TestSurefire3.testGreater" ) );
assertThat( tests.get( 2 ).getFailureType(), is( "junit.framework.AssertionFailedError" ) );
+ assertThat( tests.get( 2 ).hasError(), is( false ) );
assertThat( tests.get( 3 ).getFullClassName(), is( "wellFormedXmlFailures.TestSurefire3" ) );
assertThat( tests.get( 3 ).getName(), is( "testQuote" ) );
@@ -227,6 +230,7 @@ public class TestSuiteXmlParserTest
assertThat( tests.get( 3 ).getFailureMessage(), is( "\"" ) );
assertThat( tests.get( 3 ).getFullName(), is( "wellFormedXmlFailures.TestSurefire3.testQuote" ) );
assertThat( tests.get( 3 ).getFailureType(), is( "junit.framework.AssertionFailedError" ) );
+ assertThat( tests.get( 3 ).hasError(), is( false ) );
}
@Test
@@ -267,7 +271,7 @@ public class TestSuiteXmlParserTest
assertThat( suite.getPackageName(), is( "umlautTest" ) );
assertThat( suite.getName(), is( "BasicTest" ) );
ReportTestCase test = suite.getTestCases().iterator().next();
- assertFalse( test.hasFailure() );
+ assertTrue( test.isSuccessful() );
assertNull( test.getFailureDetail() );
assertNull( test.getFailureErrorLine() );
assertNull( test.getFailureType() );
@@ -375,7 +379,7 @@ public class TestSuiteXmlParserTest
assertThat( tests.get( 0 ).getPackageName(), is( "surefire" ) );
assertThat( tests.get( 0 ).getNumberOfTests(), is( 1 ) );
assertThat( tests.get( 0 ).getTestCases().size(), is( 1 ) );
- assertTrue( tests.get( 0 ).getTestCases().get( 0 ).hasFailure() );
+ assertFalse( tests.get( 0 ).getTestCases().get( 0 ).isSuccessful() );
assertThat( tests.get( 0 ).getTestCases().get( 0 ).getFailureErrorLine(), is( "13" ) );
assertThat( tests.get( 0 ).getTestCases().get( 0 ).getFailureType(), is( "java.lang.RuntimeException" ) );
assertThat( tests.get( 0 ).getTestCases().get( 0 ).getFullClassName(), is( "surefire.MyTest" ) );
@@ -420,6 +424,7 @@ public class TestSuiteXmlParserTest
+ "\tat surefire.MyTest$Nested.run(MyTest.java:38)\n"
+ "\tat surefire.MyTest.delegate(MyTest.java:29)\n"
+ "\tat surefire.MyTest.rethrownDelegate(MyTest.java:22)" ) );
+ assertThat( tests.get( 0 ).getTestCases().get( 0 ).hasError(), is( true ) );
}
@Test
@@ -439,7 +444,7 @@ public class TestSuiteXmlParserTest
assertThat( tests.get( 0 ).getPackageName(), is( "surefire" ) );
assertThat( tests.get( 0 ).getNumberOfTests(), is( 1 ) );
assertThat( tests.get( 0 ).getTestCases().size(), is( 1 ) );
- assertTrue( tests.get( 0 ).getTestCases().get( 0 ).hasFailure() );
+ assertFalse( tests.get( 0 ).getTestCases().get( 0 ).isSuccessful() );
assertThat( tests.get( 0 ).getTestCases().get( 0 ).getFailureErrorLine(), is( "45" ) );
assertThat( tests.get( 0 ).getTestCases().get( 0 ).getFailureType(),
is( "java.lang.RuntimeException" ) );
@@ -496,6 +501,7 @@ public class TestSuiteXmlParserTest
+ "\tat surefire.MyTest$Nested.run(MyTest.java:38)\n"
+ "\tat surefire.MyTest.delegate(MyTest.java:29)\n"
+ "\tat surefire.MyTest.rethrownDelegate(MyTest.java:22)\n" ) );
+ assertThat( tests.get( 0 ).getTestCases().get( 0 ).hasError(), is( true ) );
}
@Test
@@ -515,7 +521,7 @@ public class TestSuiteXmlParserTest
assertThat( tests.get( 0 ).getPackageName(), is( "surefire" ) );
assertThat( tests.get( 0 ).getNumberOfTests(), is( 1 ) );
assertThat( tests.get( 0 ).getTestCases().size(), is( 1 ) );
- assertTrue( tests.get( 0 ).getTestCases().get( 0 ).hasFailure() );
+ assertFalse( tests.get( 0 ).getTestCases().get( 0 ).isSuccessful() );
assertThat( tests.get( 0 ).getTestCases().get( 0 ).getFailureErrorLine(), is( "45" ) );
assertThat( tests.get( 0 ).getTestCases().get( 0 ).getFailureType(),
is( "java.lang.RuntimeException" ) );
@@ -538,6 +544,7 @@ public class TestSuiteXmlParserTest
+ "\tat surefire.MyTest.newRethrownDelegate(MyTest.java:17)\n"
+ "\tat surefire.MyTest.access$200(MyTest.java:9)\n"
+ "\tat surefire.MyTest$A.t(MyTest.java:45)\n" ) );
+ assertThat( tests.get( 0 ).getTestCases().get( 0 ).hasError(), is( true ) );
}
@Test
@@ -557,7 +564,7 @@ public class TestSuiteXmlParserTest
assertThat( tests.get( 0 ).getPackageName(), is( "surefire" ) );
assertThat( tests.get( 0 ).getNumberOfTests(), is( 1 ) );
assertThat( tests.get( 0 ).getTestCases().size(), is( 1 ) );
- assertTrue( tests.get( 0 ).getTestCases().get( 0 ).hasFailure() );
+ assertFalse( tests.get( 0 ).getTestCases().get( 0 ).isSuccessful() );
assertThat( tests.get( 0 ).getTestCases().get( 0 ).getFailureErrorLine(), is( "13" ) );
assertThat( tests.get( 0 ).getTestCases().get( 0 ).getFailureType(),
is( "java.lang.RuntimeException" ) );
@@ -605,6 +612,7 @@ public class TestSuiteXmlParserTest
+ "\tat surefire.MyTest$Nested.run(MyTest.java:38)\n"
+ "\tat surefire.MyTest.delegate(MyTest.java:29)\n"
+ "\tat surefire.MyTest.rethrownDelegate(MyTest.java:22)" ) );
+ assertThat( tests.get( 0 ).getTestCases().get( 0 ).hasError(), is( true ) );
}
@Test
@@ -624,7 +632,7 @@ public class TestSuiteXmlParserTest
assertThat( tests.get( 0 ).getPackageName(), is( "surefire" ) );
assertThat( tests.get( 0 ).getNumberOfTests(), is( 1 ) );
assertThat( tests.get( 0 ).getTestCases().size(), is( 1 ) );
- assertTrue( tests.get( 0 ).getTestCases().get( 0 ).hasFailure() );
+ assertFalse( tests.get( 0 ).getTestCases().get( 0 ).isSuccessful() );
assertThat( tests.get( 0 ).getTestCases().get( 0 ).getFailureErrorLine(), is( "13" ) );
assertThat( tests.get( 0 ).getTestCases().get( 0 ).getFailureType(),
is( "java.lang.RuntimeException" ) );
@@ -648,6 +656,7 @@ public class TestSuiteXmlParserTest
+ "\tat surefire.MyTest$Nested.run(MyTest.java:38)\n"
+ "\tat surefire.MyTest.delegate(MyTest.java:29)\n"
+ "\tat surefire.MyTest.rethrownDelegate(MyTest.java:22)" ) );
+ assertThat( tests.get( 0 ).getTestCases().get( 0 ).hasError(), is( true ) );
}
@Test