当前位置: 首页>>代码示例>>Java>>正文


Java ResultPrinter类代码示例

本文整理汇总了Java中junit.textui.ResultPrinter的典型用法代码示例。如果您正苦于以下问题:Java ResultPrinter类的具体用法?Java ResultPrinter怎么用?Java ResultPrinter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResultPrinter类属于junit.textui包,在下文中一共展示了ResultPrinter类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFailure

import junit.textui.ResultPrinter; //导入依赖的package包/类
public void testFailure() {
    String expected = expected(new String[]{".F", "Time: 0", "Failures here", "", "FAILURES!!!", "Tests run: 1,  Failures: 1,  Errors: 0", ""});
    ResultPrinter printer = new TestResultPrinter(new PrintStream(output)) {
        @Override
        public void printFailures(TestResult result) {
            getWriter().println("Failures here");
        }
    };
    runner.setPrinter(printer);
    TestSuite suite = new TestSuite();
    suite.addTest(new TestCase() {
        @Override
        public void runTest() {
            throw new AssertionFailedError();
        }
    });
    runner.doRun(suite);
    assertEquals(expected, output.toString());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:20,代码来源:TextFeedbackTest.java

示例2: testError

import junit.textui.ResultPrinter; //导入依赖的package包/类
public void testError() {
    String expected = expected(new String[]{".E", "Time: 0", "Errors here", "", "FAILURES!!!", "Tests run: 1,  Failures: 0,  Errors: 1", ""});
    ResultPrinter printer = new TestResultPrinter(new PrintStream(output)) {
        @Override
        public void printErrors(TestResult result) {
            getWriter().println("Errors here");
        }
    };
    runner.setPrinter(printer);
    TestSuite suite = new TestSuite();
    suite.addTest(new TestCase() {
        @Override
        public void runTest() throws Exception {
            throw new Exception();
        }
    });
    runner.doRun(suite);
    assertEquals(expected, output.toString());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:20,代码来源:TextFeedbackTest.java

示例3: testError

import junit.textui.ResultPrinter; //导入依赖的package包/类
public void testError() {
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    TestRunner runner = new TestRunner(new TestResultPrinter(
            new PrintStream(output)));

    String expected = expected(new String[]{".E", "Time: 0",
            "Errors here", "", "FAILURES!!!",
            "Tests run: 1,  Failures: 0,  Errors: 1", ""});
    ResultPrinter printer = new TestResultPrinter(new PrintStream(output)) {
        @Override
        public void printErrors(TestResult result) {
            getWriter().println("Errors here");
        }
    };
    runner.setPrinter(printer);
    TestSuite suite = new TestSuite();
    suite.addTest(new TestCase() {
        @Override
        public void runTest() throws Exception {
            throw new Exception();
        }
    });
    runner.doRun(suite);
    assertEquals(expected, output.toString());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:26,代码来源:ForwardCompatibilityPrintingTest.java

示例4: testErrorAdapted

import junit.textui.ResultPrinter; //导入依赖的package包/类
public void testErrorAdapted() {
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    TestRunner runner = new TestRunner(new TestResultPrinter(
            new PrintStream(output)));

    String expected = expected(new String[]{".E", "Time: 0",
            "Errors here", "", "FAILURES!!!",
            "Tests run: 1,  Failures: 0,  Errors: 1", ""});
    ResultPrinter printer = new TestResultPrinter(new PrintStream(output)) {
        @Override
        public void printErrors(TestResult result) {
            getWriter().println("Errors here");
        }
    };
    runner.setPrinter(printer);
    runner.doRun(new JUnit4TestAdapter(ATest.class));
    assertEquals(expected, output.toString());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:19,代码来源:ForwardCompatibilityPrintingTest.java

示例5: testFailure

import junit.textui.ResultPrinter; //导入依赖的package包/类
public void testFailure() {
	String expected= expected(new String[]{".F", "Time: 0", "Failures here", "", "FAILURES!!!", "Tests run: 1,  Failures: 1,  Errors: 0", ""});
	ResultPrinter printer= new TestResultPrinter(new PrintStream(output)) {
		public void printFailures(TestResult result) {
			getWriter().println("Failures here");
		}
	};
	runner.setPrinter(printer);
	TestSuite suite = new TestSuite();
	suite.addTest(new TestCase() { public void runTest() {throw new AssertionFailedError();}});
	runner.doRun(suite);
	assertEquals(expected, output.toString());
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:14,代码来源:TextFeedbackTest.java

示例6: testError

import junit.textui.ResultPrinter; //导入依赖的package包/类
public void testError() {
	String expected= expected(new String[]{".E", "Time: 0", "Errors here", "", "FAILURES!!!", "Tests run: 1,  Failures: 0,  Errors: 1", ""});
	ResultPrinter printer= new TestResultPrinter(new PrintStream(output)) {
		public void printErrors(TestResult result) {
			getWriter().println("Errors here");
		}
	};
	runner.setPrinter(printer);
	TestSuite suite = new TestSuite();
	suite.addTest(new TestCase() { public void runTest() throws Exception {throw new Exception();}});
	runner.doRun(suite);
	assertEquals(expected, output.toString());
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:14,代码来源:TextFeedbackTest.java

示例7: testSingle

import junit.textui.ResultPrinter; //导入依赖的package包/类
public void testSingle() throws Exception {
    TestRunner t = new TestRunner();
    t.setPrinter(new ResultPrinter(new PrintStream(new ByteArrayOutputStream())));
    String[] args = {
            "-m", "junit.tests.runner.TextRunnerSingleMethodTest$InvocationTest.testWasInvoked"
    };
    fgWasInvoked = false;
    t.start(args);
    assertTrue(fgWasInvoked);
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:11,代码来源:TextRunnerSingleMethodTest.java

示例8: TestRunner

import junit.textui.ResultPrinter; //导入依赖的package包/类
/**
 * Constructs a TestRunner using the given ResultPrinter all the output
 */
public TestRunner(ResultPrinter printer) {
	super(printer);
}
 
开发者ID:mpgerstl,项目名称:tEFMA,代码行数:7,代码来源:TestRunner.java

示例9: createPrinter

import junit.textui.ResultPrinter; //导入依赖的package包/类
protected ResultPrinter createPrinter() {
    return new CoreTestPrinter(System.out, fFlags);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:4,代码来源:CoreTestRunner.java

示例10: TestRunner

import junit.textui.ResultPrinter; //导入依赖的package包/类
/**
 * Constructs a TestRunner using the given stream for all the output
 */
public TestRunner(PrintStream writer) {
    this(new ResultPrinter(writer));
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:7,代码来源:TestRunner.java

示例11: setPrinter

import junit.textui.ResultPrinter; //导入依赖的package包/类
public void setPrinter(ResultPrinter printer) {
    fPrinter= printer;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:4,代码来源:TestRunner.java

示例12: TestRunnerImprovedErrorHandling

import junit.textui.ResultPrinter; //导入依赖的package包/类
/**
 * Delegates to the super constructor.
 *
 * @param resultPrinter The location to write test results to.
 */
public TestRunnerImprovedErrorHandling(ResultPrinter resultPrinter)
{
    super(resultPrinter);
}
 
开发者ID:wso2,项目名称:andes,代码行数:10,代码来源:TestRunnerImprovedErrorHandling.java


注:本文中的junit.textui.ResultPrinter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。