Lines 42-47
Link Here
|
42 |
package org.netbeans.modules.ruby.testrunner.ui; |
42 |
package org.netbeans.modules.ruby.testrunner.ui; |
43 |
|
43 |
|
44 |
import java.awt.Image; |
44 |
import java.awt.Image; |
|
|
45 |
import java.io.CharConversionException; |
45 |
import java.util.HashMap; |
46 |
import java.util.HashMap; |
46 |
import java.util.Map; |
47 |
import java.util.Map; |
47 |
import javax.swing.Action; |
48 |
import javax.swing.Action; |
Lines 51-62
Link Here
|
51 |
import org.openide.util.ImageUtilities; |
52 |
import org.openide.util.ImageUtilities; |
52 |
import org.openide.util.NbBundle; |
53 |
import org.openide.util.NbBundle; |
53 |
import org.openide.util.actions.SystemAction; |
54 |
import org.openide.util.actions.SystemAction; |
|
|
55 |
import org.openide.xml.XMLUtil; |
54 |
|
56 |
|
55 |
/** |
57 |
/** |
56 |
* |
58 |
* |
57 |
* @author Marian Petras, Erno Mononen |
59 |
* @author Marian Petras, Erno Mononen |
58 |
*/ |
60 |
*/ |
59 |
final class TestMethodNode extends AbstractNode { |
61 |
final class TestMethodNode extends AbstractNode { |
|
|
62 |
private static final boolean INLINE_RESULTS = Boolean.getBoolean("junit.inline_result"); // NOI18N |
60 |
|
63 |
|
61 |
/** */ |
64 |
/** */ |
62 |
private final Report.Testcase testcase; |
65 |
private final Report.Testcase testcase; |
Lines 119-124
Link Here
|
119 |
buf.append(" "); //NOI18N |
122 |
buf.append(" "); //NOI18N |
120 |
buf.append("<font color='#"); //NOI18N |
123 |
buf.append("<font color='#"); //NOI18N |
121 |
buf.append(status.getHtmlDisplayColor() + "'>"); //NOI18N |
124 |
buf.append(status.getHtmlDisplayColor() + "'>"); //NOI18N |
|
|
125 |
|
126 |
String cause = null; |
127 |
// if (INLINE_RESULTS && testcase.trouble != null && testcase.trouble.message != null && |
128 |
// !"null".equals(testcase.trouble.message)) { // NOI18N |
129 |
if (INLINE_RESULTS && testcase.trouble != null && testcase.trouble.stackTrace != null && |
130 |
testcase.trouble.stackTrace.length > 0) { |
131 |
try { |
132 |
//cause = XMLUtil.toElementContent(testcase.trouble.message); |
133 |
cause = XMLUtil.toElementContent(testcase.trouble.stackTrace[0]); |
134 |
} catch (CharConversionException ex) { |
135 |
// We're messing with user testoutput - always risky. Don't complain |
136 |
// here, simply fall back to the old behavior of the test runner - |
137 |
// don't include the message |
138 |
cause = null; |
139 |
} |
140 |
} |
141 |
if (cause != null) { |
142 |
buf.append(NbBundle.getMessage(getClass(), |
143 |
DisplayNameMapper.getCauseKey(status), cause)); |
144 |
} else |
122 |
buf.append(testcase.timeMillis < 0 |
145 |
buf.append(testcase.timeMillis < 0 |
123 |
? NbBundle.getMessage(getClass(), |
146 |
? NbBundle.getMessage(getClass(), |
124 |
DisplayNameMapper.getNoTimeKey(status)) |
147 |
DisplayNameMapper.getNoTimeKey(status)) |
Lines 211-216
Link Here
|
211 |
result.put(Status.PENDING, "MSG_TestMethodPending_HTML_time"); //NOI18N |
234 |
result.put(Status.PENDING, "MSG_TestMethodPending_HTML_time"); //NOI18N |
212 |
return result; |
235 |
return result; |
213 |
} |
236 |
} |
|
|
237 |
|
238 |
private static final Map< Status,String> CAUSE_KEYS = initCauseKeys(); |
239 |
private static Map< Status,String> initCauseKeys() { |
240 |
Map< Status,String> result = new HashMap< Status,String>(4); |
241 |
result.put(Status.PASSED, "MSG_TestMethodPassed_HTML_cause"); //NOI18N |
242 |
result.put(Status.ERROR, "MSG_TestMethodError_HTML_cause"); //NOI18N |
243 |
result.put(Status.FAILED, "MSG_TestMethodFailed_HTML_cause"); //NOI18N |
244 |
result.put(Status.PENDING, "MSG_TestMethodPending_HTML_cause"); //NOI18N |
245 |
return result; |
246 |
} |
247 |
static String getCauseKey(Status status) { |
248 |
return CAUSE_KEYS.get(status); |
249 |
} |
214 |
|
250 |
|
215 |
static String getNoTimeKey(Status status) { |
251 |
static String getNoTimeKey(Status status) { |
216 |
return NO_TIME_KEYS.get(status); |
252 |
return NO_TIME_KEYS.get(status); |
Lines 219-224
Link Here
|
219 |
static String getTimeKey(Status status) { |
255 |
static String getTimeKey(Status status) { |
220 |
return TIME_KEYS.get(status); |
256 |
return TIME_KEYS.get(status); |
221 |
} |
257 |
} |
222 |
|
|
|
223 |
} |
258 |
} |
224 |
} |
259 |
} |