This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 149315
Collapse All | Expand All

(-)a/junit/src/org/netbeans/modules/junit/output/Bundle.properties (+2 lines)
Lines 95-100 Link Here
95
MSG_TestMethodPassed_HTML=passed
95
MSG_TestMethodPassed_HTML=passed
96
MSG_TestMethodFailed_HTML=failed
96
MSG_TestMethodFailed_HTML=failed
97
MSG_TestMethodError_HTML=caused an error
97
MSG_TestMethodError_HTML=caused an error
98
MSG_TestMethodFailed_HTML_cause=failed ({0})
99
MSG_TestMethodError_HTML_cause=caused an error ({0})
98
MSG_TestMethodInterrupted_HTML=interrupted
100
MSG_TestMethodInterrupted_HTML=interrupted
99
101
100
# {0} .. name of the test method, {1} .. elapsed time in seconds
102
# {0} .. name of the test method, {1} .. elapsed time in seconds
(-)a/junit/src/org/netbeans/modules/junit/output/TestMethodNode.java (+39 lines)
Lines 41-46 Link Here
41
41
42
package org.netbeans.modules.junit.output;
42
package org.netbeans.modules.junit.output;
43
43
44
import java.io.CharConversionException;
44
import java.util.ArrayList;
45
import java.util.ArrayList;
45
import java.util.List;
46
import java.util.List;
46
import javax.swing.Action;
47
import javax.swing.Action;
Lines 55-60 Link Here
55
import org.openide.util.Lookup;
56
import org.openide.util.Lookup;
56
import org.openide.util.NbBundle;
57
import org.openide.util.NbBundle;
57
import org.openide.util.lookup.Lookups;
58
import org.openide.util.lookup.Lookups;
59
import org.openide.xml.XMLUtil;
58
import static org.netbeans.modules.junit.output.HtmlMarkupUtils.COLOR_OK;
60
import static org.netbeans.modules.junit.output.HtmlMarkupUtils.COLOR_OK;
59
import static org.netbeans.modules.junit.output.HtmlMarkupUtils.COLOR_WARNING;
61
import static org.netbeans.modules.junit.output.HtmlMarkupUtils.COLOR_WARNING;
60
import static org.netbeans.modules.junit.output.HtmlMarkupUtils.COLOR_FAILURE;
62
import static org.netbeans.modules.junit.output.HtmlMarkupUtils.COLOR_FAILURE;
Lines 68-73 Link Here
68
 * @author Marian Petras
70
 * @author Marian Petras
69
 */
71
 */
70
final class TestMethodNode extends AbstractNode {
72
final class TestMethodNode extends AbstractNode {
73
    private static final boolean INLINE_RESULTS = Boolean.getBoolean("junit.inline_result"); // NOI18N
71
74
72
    private static final String[] NO_TIME_STATUS_KEYS = new String[] {
75
    private static final String[] NO_TIME_STATUS_KEYS = new String[] {
73
                                      null,
76
                                      null,
Lines 83-88 Link Here
83
                                      "MSG_TestMethodPassed_HTML",      //NOI18N
86
                                      "MSG_TestMethodPassed_HTML",      //NOI18N
84
                                      "MSG_TestMethodError_HTML",       //NOI18N
87
                                      "MSG_TestMethodError_HTML",       //NOI18N
85
                                      "MSG_TestMethodFailed_HTML"};     //NOI18N
88
                                      "MSG_TestMethodFailed_HTML"};     //NOI18N
89
    private static final String[] STATUS_KEYS_HTML_CAUSE = new String[] {
90
                                      "MSG_TestMethodPassed_HTML",      //NOI18N
91
                                      "MSG_TestMethodError_HTML_cause", //NOI18N
92
                                      "MSG_TestMethodFailed_HTML_cause"};//NOI18N
86
    private static final String[] TIME_STATUS_KEYS_HTML = new String[] {
93
    private static final String[] TIME_STATUS_KEYS_HTML = new String[] {
87
                                      "MSG_TestMethodPassed_HTML_time", //NOI18N
94
                                      "MSG_TestMethodPassed_HTML_time", //NOI18N
88
                                      "MSG_TestMethodError_HTML_time",  //NOI18N
95
                                      "MSG_TestMethodError_HTML_time",  //NOI18N
Lines 122-127 Link Here
122
129
123
        String bundleKey;
130
        String bundleKey;
124
        Object[] bundleParams;
131
        Object[] bundleParams;
132
        String cause = null;
133
        if (INLINE_RESULTS && testcase.trouble != null && testcase.trouble.message != null && 
134
                !"null".equals(testcase.trouble.message)) { // NOI18N
135
            try {
136
                cause = XMLUtil.toElementContent(testcase.trouble.message);
137
            } catch (CharConversionException ex) {
138
                // We're messing with user testoutput - always risky. Don't complain
139
                // here, simply fall back to the old behavior of the test runner -
140
                // don't include the message
141
                cause = null;
142
            }
143
        }
144
        if (cause != null) {
145
            bundleKey = STATUS_KEYS_HTML_CAUSE[status];
146
            bundleParams = new Object[] { cause };
147
        } else
125
        if (testcase.timeMillis == Testcase.NOT_FINISHED_YET) {
148
        if (testcase.timeMillis == Testcase.NOT_FINISHED_YET) {
126
            bundleKey = STATUS_KEY_INTERRUPTED;
149
            bundleKey = STATUS_KEY_INTERRUPTED;
127
            bundleParams = new Object[] {testcase.name};
150
            bundleParams = new Object[] {testcase.name};
Lines 147-152 Link Here
147
        String bundleKey;
170
        String bundleKey;
148
        Object bundleParam;
171
        Object bundleParam;
149
        String color = null;
172
        String color = null;
173
        String cause = null;
174
        if (INLINE_RESULTS && testcase.trouble != null && testcase.trouble.message != null &&
175
                !"null".equals(testcase.trouble.message)) { // NOI18N
176
            try {
177
                cause = XMLUtil.toElementContent(testcase.trouble.message);
178
            } catch (CharConversionException ex) {
179
                // We're messing with user testoutput - always risky. Don't complain
180
                // here, simply fall back to the old behavior of the test runner -
181
                // don't include the message
182
                cause = null;
183
            }
184
        }
185
        if (cause != null) {
186
            bundleKey = STATUS_KEYS_HTML_CAUSE[status];
187
            bundleParam = cause;
188
        } else
150
        if (testcase.timeMillis == Testcase.NOT_FINISHED_YET) {
189
        if (testcase.timeMillis == Testcase.NOT_FINISHED_YET) {
151
            bundleKey = STATUS_KEY_INTERRUPTED_HTML;
190
            bundleKey = STATUS_KEY_INTERRUPTED_HTML;
152
            bundleParam = null;
191
            bundleParam = null;

Return to bug 149315