| Code with Finding: |
class SuitePanel {
private void generateMethod(ITestResult tr, XMLStringBuffer xsb) {
xsb.push(D, C, "method");
xsb.push(D, C, "method-content");
xsb.push("a", "name", Model.getTestResultName(tr));
xsb.pop("a");
xsb.addOptional(S, tr.getMethod().getMethodName(), C, "method-name");
// Parameters?
if (tr.getParameters().length > 0) {
StringBuilder sb = new StringBuilder();
boolean first = true;
for (Object p : tr.getParameters()) {
if (!first) sb.append(", ");
first = false;
sb.append(Utils.toString(p));
}
xsb.addOptional(S, "(" + sb.toString() + ")", C, "parameters");
}
// Exception?
if (tr.getStatus() != ITestResult.SUCCESS && tr.getThrowable() != null) {
StringBuilder stackTrace = new StringBuilder();
stackTrace.append(Utils.stackTrace(tr.getThrowable(), true)[0]);
xsb.addOptional(D, stackTrace.toString() + "\n",
C, "stack-trace");
}
// Description?
String description = tr.getMethod().getDescription();
if (! Strings.isNullOrEmpty(description)) {
xsb.push("em");
xsb.addString("(" + description + ")");
xsb.pop("em");
}
// long time = tr.getEndMillis() - tr.getStartMillis();
// xsb.addOptional(S, " " + Long.toString(time) + " ms", C, "method-time");
xsb.pop(D);
xsb.pop(D);
}
}
|