本文整理汇总了Java中junit.framework.Test.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Test.toString方法的具体用法?Java Test.toString怎么用?Java Test.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类junit.framework.Test
的用法示例。
在下文中一共展示了Test.toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addError
import junit.framework.Test; //导入方法依赖的package包/类
@Override
public void addError(Test arg0, Throwable arg1) {
String testName = "unknown";
if (arg0 != null) {
testName = arg0.toString();
int idx = testName.indexOf('(');
if (idx > 0) {
testName = testName.substring(0, idx);
}
}
out.println(" " + testName + " had an error.");
StackTraceElement[] st = arg1.getStackTrace();
int i = 0;
for (StackTraceElement ste : st) {
if (ste.getClassName().contains("org.voltdb") == false)
continue;
out.printf(" %s(%s:%d)\n", ste.getClassName(), ste.getFileName(), ste.getLineNumber());
if (++i == 3) break;
}
m_errs++;
}
示例2: addFailure
import junit.framework.Test; //导入方法依赖的package包/类
@Override
public void addFailure(Test arg0, AssertionFailedError arg1) {
String testName = arg0.toString();
testName = testName.substring(0, testName.indexOf('('));
out.println(" " + testName + " failed an assertion.");
StackTraceElement[] st = arg1.getStackTrace();
int i = 0;
for (StackTraceElement ste : st) {
if (ste.getClassName().contains("org.voltdb") == false)
continue;
out.printf(" %s(%s:%d)\n", ste.getClassName(), ste.getFileName(), ste.getLineNumber());
if (++i == 3) break;
}
m_failures++;
}
示例3: updateItem
import junit.framework.Test; //导入方法依赖的package包/类
@Override protected void updateItem(Test test, boolean empty) {
super.updateItem(test, empty);
if (test != null && !empty) {
String value;
if (test instanceof TestSuite) {
value = ((TestSuite) test).getName();
} else if (test instanceof MarathonTestCase) {
value = ((MarathonTestCase) test).getName();
} else {
value = test.toString();
}
setText(value);
Node icon = test instanceof TestSuite ? FXUIUtils.getIcon("tsuite") : FXUIUtils.getIcon("ttest");
State state = ((TestTreeItem) getTreeItem()).getState();
if (test instanceof TestSuite) {
if (state == State.RUNNING) {
icon = FXUIUtils.getIcon("wait16trans");
}
if (state == State.SUCCESS) {
icon = FXUIUtils.getIcon("tsuiteok");
}
if (state == State.ERROR) {
icon = FXUIUtils.getIcon("tsuiteerror");
}
if (state == State.FAILURE) {
icon = FXUIUtils.getIcon("tsuitefail");
}
} else {
if (state == State.RUNNING) {
icon = FXUIUtils.getIcon("wait16trans");
}
if (state == State.SUCCESS) {
icon = FXUIUtils.getIcon("testok");
}
if (state == State.ERROR) {
icon = FXUIUtils.getIcon("testerror");
}
if (state == State.FAILURE) {
icon = FXUIUtils.getIcon("testfail");
}
}
setGraphic(icon);
} else {
setText(null);
setGraphic(null);
}
}