本文整理汇总了Java中junit.runner.BaseTestRunner类的典型用法代码示例。如果您正苦于以下问题:Java BaseTestRunner类的具体用法?Java BaseTestRunner怎么用?Java BaseTestRunner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BaseTestRunner类属于junit.runner包,在下文中一共展示了BaseTestRunner类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayProblems
import junit.runner.BaseTestRunner; //导入依赖的package包/类
private void displayProblems( PrintWriter writer, String kind, int count, Enumeration enumeration ) {
if (count != 0) {
displayProblemTitle( writer, getFormatted( count, kind ) );
Enumeration e = enumeration;
for (int i = 1; e.hasMoreElements(); i++) {
TestFailure failure = (TestFailure) e.nextElement();
displayProblemDetailHeader( writer, i, failure.failedTest().toString() );
if (failure.thrownException() instanceof AssertionFailedError) {
displayProblemDetail( writer, failure.thrownException().getMessage() );
} else {
displayProblemDetail( writer, BaseTestRunner.getFilteredTrace( failure.thrownException() ) );
}
displayProblemDetailFooter( writer );
}
}
}
示例2: displayResults
import junit.runner.BaseTestRunner; //导入依赖的package包/类
private void displayResults( PrintWriter writer, String failureNodeName, Enumeration resultsEnumeration ) {
for (Enumeration e = resultsEnumeration; e.hasMoreElements();) {
TestFailure failure = (TestFailure) e.nextElement();
writer.println( " <testcase name=" + asAttribute( failure.failedTest().toString() ) + ">" );
writer.print( " <" + failureNodeName + " type=" + asAttribute( failure.thrownException().getClass().getName() ) +
" message=" + asAttribute( failure.exceptionMessage() ) );
if (!displayException( failure )) {
writer.println( "/>" );
} else {
writer.println( ">" );
writer.print( sgmlEscape( BaseTestRunner.getFilteredTrace( failure.thrownException() ) ) );
writer.println( " </" + failureNodeName + ">" );
}
writer.println( " </testcase>" );
}
}
示例3: SLDTestRunner
import junit.runner.BaseTestRunner; //导入依赖的package包/类
/**
* Instantiates a new SLD test runner.
*/
public SLDTestRunner() {
BaseTestRunner.setPreference("maxmessage", "-1");
System.out.println("Operating system is : " + OSValidator.getOS());
// Populate the list of fields that are colours
colourFieldsList.add(FieldIdEnum.FILL_COLOUR);
colourFieldsList.add(FieldIdEnum.STROKE_FILL_COLOUR);
colourFieldsList.add(FieldIdEnum.STROKE_STROKE_COLOUR);
colourFieldsList.add(FieldIdEnum.HALO_COLOUR);
filenameList.add(FieldIdEnum.SYMBOL_TYPE);
filenameList.add(FieldIdEnum.EXTERNAL_GRAPHIC);
filenameList.add(FieldIdEnum.TTF_SYMBOL);
try {
sldEditor = SLDEditor.createAndShowGUI(null, null, true, null);
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: printFailure
import junit.runner.BaseTestRunner; //导入依赖的package包/类
void printFailure(KXmlSerializer serializer, String type, Throwable t)
throws IOException {
serializer.startTag(ns, TESTCASE);
printAttributes(serializer);
serializer.startTag(ns, type);
String message = t.getMessage();
if (message != null && message.length() > 0) {
serializer.attribute(ns, ATTR_MESSAGE, t.getMessage());
}
serializer.attribute(ns, ATTR_TYPE, t.getClass().getName());
serializer.text(sanitize(BaseTestRunner.getFilteredTrace(t)));
serializer.endTag(ns, type);
serializer.endTag(ns, TESTCASE);
}
示例5: run
import junit.runner.BaseTestRunner; //导入依赖的package包/类
private void run(Class... tests) {
runs = new ArrayList<Integer>();
BaseTestRunner runner = new TestRunner();
for (Class test : tests) {
TestResult result = new TestResult();
//result.addListener(new ResultPrinter(System.err));
runner.getTest(test.getName()).run(result);
assertEquals("failures in " + test, Collections.emptyList(), Collections.list((Enumeration<?>) result.failures()));
assertEquals("errors in " + test, Collections.emptyList(), Collections.list((Enumeration<?>) result.errors()));
}
Collections.sort(runs);
}
示例6: addError
import junit.runner.BaseTestRunner; //导入依赖的package包/类
@Override
public void addError(Test test, Throwable t) {
mTestResult.putString(REPORT_KEY_STACK, BaseTestRunner.getFilteredTrace(t));
mTestResultCode = REPORT_VALUE_RESULT_ERROR;
// pretty printing
mTestResult.putString(Instrumentation.REPORT_KEY_STREAMRESULT, String.format("\nError in %s:\n%s", ((TestCase) test).getName(), BaseTestRunner.getFilteredTrace(t)));
mPrinter.addError(test, t);
}
示例7: addFailure
import junit.runner.BaseTestRunner; //导入依赖的package包/类
@Override
public void addFailure(Test test, AssertionFailedError t) {
mTestResult.putString(REPORT_KEY_STACK, BaseTestRunner.getFilteredTrace(t));
mTestResultCode = REPORT_VALUE_RESULT_FAILURE;
// pretty printing
mTestResult.putString(Instrumentation.REPORT_KEY_STREAMRESULT, String.format("\nFailure in %s:\n%s", ((TestCase) test).getName(), BaseTestRunner.getFilteredTrace(t)));
mPrinter.addFailure(test, t);
}
示例8: testInvokeNonStaticSuite
import junit.runner.BaseTestRunner; //导入依赖的package包/类
public void testInvokeNonStaticSuite() {
BaseTestRunner runner= new MockRunner();
runner.getTest("junit.tests.runner.BaseTestRunnerTest$NonStatic"); // Used to throw NullPointerException
}
示例9: testFilter
import junit.runner.BaseTestRunner; //导入依赖的package包/类
public void testFilter() {
assertEquals(fFiltered, BaseTestRunner.getFilteredTrace(fUnfiltered));
}
示例10: printDefectTrace
import junit.runner.BaseTestRunner; //导入依赖的package包/类
protected void printDefectTrace(TestFailure booBoo) {
getWriter().print(BaseTestRunner.getFilteredTrace(booBoo.trace()));
}
示例11: testInvokeNonStaticSuite
import junit.runner.BaseTestRunner; //导入依赖的package包/类
public void testInvokeNonStaticSuite() {
BaseTestRunner runner = new MockRunner();
runner.getTest("junit.tests.runner.BaseTestRunnerTest$NonStatic"); // Used to throw NullPointerException
}
示例12: testFilter
import junit.runner.BaseTestRunner; //导入依赖的package包/类
public void testFilter() {
assertEquals(fFiltered, BaseTestRunner.getFilteredTrace(fUnfiltered));
}
示例13: addError
import junit.runner.BaseTestRunner; //导入依赖的package包/类
@Override
public void addError(final Test test, final Throwable e) {
pLogger.logDebug(this, "addError", "Error in test [%s]!\n%s", test
.getClass().getName(), BaseTestRunner.getFilteredTrace(e));
}
示例14: addFailure
import junit.runner.BaseTestRunner; //导入依赖的package包/类
@Override
public void addFailure(final Test test, final AssertionFailedError e) {
pLogger.logDebug(this, "addFailure", "Test [%s] failed!\n%s", test
.getClass().getName(), BaseTestRunner.getFilteredTrace(e));
}