diff -r c16691cbb050 junit/src/org/netbeans/modules/junit/output/Bundle.properties --- a/junit/src/org/netbeans/modules/junit/output/Bundle.properties Mon Oct 06 16:59:47 2008 -0700 +++ b/junit/src/org/netbeans/modules/junit/output/Bundle.properties Mon Oct 06 17:21:11 2008 -0700 @@ -95,6 +95,8 @@ MSG_TestMethodPassed_HTML=passed MSG_TestMethodFailed_HTML=failed MSG_TestMethodError_HTML=caused an error +MSG_TestMethodFailed_HTML_cause=failed ({0}) +MSG_TestMethodError_HTML_cause=caused an error ({0}) MSG_TestMethodInterrupted_HTML=interrupted # {0} .. name of the test method, {1} .. elapsed time in seconds diff -r c16691cbb050 junit/src/org/netbeans/modules/junit/output/TestMethodNode.java --- a/junit/src/org/netbeans/modules/junit/output/TestMethodNode.java Mon Oct 06 16:59:47 2008 -0700 +++ b/junit/src/org/netbeans/modules/junit/output/TestMethodNode.java Mon Oct 06 17:21:11 2008 -0700 @@ -41,6 +41,7 @@ package org.netbeans.modules.junit.output; +import java.io.CharConversionException; import java.util.ArrayList; import java.util.List; import javax.swing.Action; @@ -55,6 +56,7 @@ import org.openide.util.Lookup; import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; +import org.openide.xml.XMLUtil; import static org.netbeans.modules.junit.output.HtmlMarkupUtils.COLOR_OK; import static org.netbeans.modules.junit.output.HtmlMarkupUtils.COLOR_WARNING; import static org.netbeans.modules.junit.output.HtmlMarkupUtils.COLOR_FAILURE; @@ -68,6 +70,7 @@ * @author Marian Petras */ final class TestMethodNode extends AbstractNode { + private static final boolean INLINE_RESULTS = Boolean.getBoolean("junit.inline_result"); // NOI18N private static final String[] NO_TIME_STATUS_KEYS = new String[] { null, @@ -83,6 +86,10 @@ "MSG_TestMethodPassed_HTML", //NOI18N "MSG_TestMethodError_HTML", //NOI18N "MSG_TestMethodFailed_HTML"}; //NOI18N + private static final String[] STATUS_KEYS_HTML_CAUSE = new String[] { + "MSG_TestMethodPassed_HTML", //NOI18N + "MSG_TestMethodError_HTML_cause", //NOI18N + "MSG_TestMethodFailed_HTML_cause"};//NOI18N private static final String[] TIME_STATUS_KEYS_HTML = new String[] { "MSG_TestMethodPassed_HTML_time", //NOI18N "MSG_TestMethodError_HTML_time", //NOI18N @@ -122,6 +129,22 @@ String bundleKey; Object[] bundleParams; + String cause = null; + if (INLINE_RESULTS && testcase.trouble != null && testcase.trouble.message != null && + !"null".equals(testcase.trouble.message)) { // NOI18N + try { + cause = XMLUtil.toElementContent(testcase.trouble.message); + } catch (CharConversionException ex) { + // We're messing with user testoutput - always risky. Don't complain + // here, simply fall back to the old behavior of the test runner - + // don't include the message + cause = null; + } + } + if (cause != null) { + bundleKey = STATUS_KEYS_HTML_CAUSE[status]; + bundleParams = new Object[] { cause }; + } else if (testcase.timeMillis == Testcase.NOT_FINISHED_YET) { bundleKey = STATUS_KEY_INTERRUPTED; bundleParams = new Object[] {testcase.name}; @@ -147,6 +170,22 @@ String bundleKey; Object bundleParam; String color = null; + String cause = null; + if (INLINE_RESULTS && testcase.trouble != null && testcase.trouble.message != null && + !"null".equals(testcase.trouble.message)) { // NOI18N + try { + cause = XMLUtil.toElementContent(testcase.trouble.message); + } catch (CharConversionException ex) { + // We're messing with user testoutput - always risky. Don't complain + // here, simply fall back to the old behavior of the test runner - + // don't include the message + cause = null; + } + } + if (cause != null) { + bundleKey = STATUS_KEYS_HTML_CAUSE[status]; + bundleParam = cause; + } else if (testcase.timeMillis == Testcase.NOT_FINISHED_YET) { bundleKey = STATUS_KEY_INTERRUPTED_HTML; bundleParam = null;