From dev-return-65167-apmail-ant-dev-archive=ant.apache.org@ant.apache.org Thu Mar 17 08:21:54 2005 Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 56651 invoked from network); 17 Mar 2005 08:21:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 17 Mar 2005 08:21:53 -0000 Received: (qmail 44514 invoked by uid 500); 17 Mar 2005 08:21:49 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 44446 invoked by uid 500); 17 Mar 2005 08:21:49 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 44402 invoked by uid 500); 17 Mar 2005 08:21:48 -0000 Received: (qmail 44376 invoked by uid 99); 17 Mar 2005 08:21:48 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 17 Mar 2005 00:21:47 -0800 Received: (qmail 56575 invoked by uid 1146); 17 Mar 2005 08:21:46 -0000 Date: 17 Mar 2005 08:21:46 -0000 Message-ID: <20050317082146.56574.qmail@minotaur.apache.org> From: bodewig@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit XMLJUnitResultFormatter.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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