Author: emuckenhuber
Date: 2007-10-20 09:59:49 -0400 (Sat, 20 Oct 2007)
New Revision: 8722
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java
Log:
- checking if cause is null
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java 2007-10-20
12:45:09 UTC (rev 8721)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java 2007-10-20
13:59:49 UTC (rev 8722)
@@ -36,7 +36,6 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
@@ -61,7 +60,6 @@
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.event.StartRunnerEvent;
import org.jboss.unit.runner.event.StartTestCaseEvent;
-import org.jboss.unit.runner.event.StartTestSuiteEvent;
import org.jboss.unit.runner.results.TestFailure;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -229,7 +227,7 @@
errorNotStarted.setAttribute(XMLConstants.ATTR_MESSAGE, "TestCase: " +
testName + " was not started properly. (No StartTestEvent)");
test.appendChild(errorNotStarted);
}
-
+
/** If testcase failed */
if (result instanceof TestFailure)
{
@@ -248,9 +246,12 @@
this.errors++;
failureType = XMLConstants.ERROR;
}
+ if (failure.getCause() != null)
+ {
+ test.appendChild(addError(failureType, failure.getCause()));
+ }
+ }
- test.appendChild(addError(failureType, failure.getCause()));
- }
this.rootElement.appendChild(test);
}
@@ -313,6 +314,8 @@
Source source = new DOMSource(this.rootElement);
Transformer xtrans = TransformerFactory.newInstance().newTransformer();
xtrans.setOutputProperty(OutputKeys.INDENT, "yes");
+ xtrans.setOutputProperty(OutputKeys.METHOD, "xml");
+ xtrans.setOutputProperty(OutputKeys.STANDALONE, "yes");
Result result = new StreamResult(new FileOutputStream(file));
xtrans.transform(source, result);
}
Show replies by date