bodewig 2005/03/17 00:21:46
Modified: src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_16_BRANCH XMLJUnitResultFormatter.java
Log:
merge
Revision Changes Path
No revision
No revision
1.30.2.6 +8 -3 ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
Index: XMLJUnitResultFormatter.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java,v
retrieving revision 1.30.2.5
retrieving revision 1.30.2.6
diff -u -r1.30.2.5 -r1.30.2.6
--- XMLJUnitResultFormatter.java 9 Mar 2004 17:01:50 -0000 1.30.2.5
+++ XMLJUnitResultFormatter.java 17 Mar 2005 08:21:46 -0000 1.30.2.6
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2004 The Apache Software Foundation
+ * Copyright 2000-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,6 +45,9 @@
public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstants {
+ /** constant for unnnamed testsuites/cases */
+ private static final String UNKNOWN = "unknown";
+
private static DocumentBuilder getDocumentBuilder() {
try {
return DocumentBuilderFactory.newInstance().newDocumentBuilder();
@@ -99,7 +102,8 @@
public void startTestSuite(JUnitTest suite) {
doc = getDocumentBuilder().newDocument();
rootElement = doc.createElement(TESTSUITE);
- rootElement.setAttribute(ATTR_NAME, suite.getName());
+ String n = suite.getName();
+ rootElement.setAttribute(ATTR_NAME, n == null ? UNKNOWN : n);
// Output properties
Element propsElement = doc.createElement(PROPERTIES);
@@ -173,8 +177,9 @@
Element currentTest = null;
if (!failedTests.containsKey(test)) {
currentTest = doc.createElement(TESTCASE);
+ String n = JUnitVersionHelper.getTestCaseName(test);
currentTest.setAttribute(ATTR_NAME,
- JUnitVersionHelper.getTestCaseName(test));
+ n == null ? UNKNOWN : n);
// a TestSuite can contain Tests from multiple classes,
// even tests with the same name - disambiguate them.
currentTest.setAttribute(ATTR_CLASSNAME,
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
|