From: Kent B. <kb...@us...> - 2002-04-09 19:43:31
|
Update of /cvsroot/junit/junit/junit/tests/runner In directory usw-pr-cvs1:/tmp/cvs-serv8764/junit/tests/runner Modified Files: AllTests.java Added Files: TextFeedbackTest.java Log Message: Began writing tests for the textui.TestRunner in preparation for refactoring --- NEW FILE: TextFeedbackTest.java --- package junit.tests.runner; import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.io.PrintStream; import java.text.Collator; import java.text.RuleBasedCollator; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; public class TextFeedbackTest extends TestCase { public static void main(String[] args) { TestRunner.run(TextFeedbackTest.class); } public void testNormalOperation() { OutputStream output= new ByteArrayOutputStream(); PrintStream writer= new PrintStream(output); String expected= expected(new String[]{"", "Time: 0", "", "OK (0 tests)", ""}); TestRunner runner= new TestRunner(writer); runner.doRun(new TestSuite()); Collator c= Collator.getInstance(); assertEquals(expected.toString(), output.toString()); } private String expected(String[] lines) { OutputStream expected= new ByteArrayOutputStream(); PrintStream expectedWriter= new PrintStream(expected); expectedWriter.println(); expectedWriter.println("Time: 0"); expectedWriter.println(); expectedWriter.println("OK (0 tests)"); expectedWriter.println(); return expected.toString(); } } Index: AllTests.java =================================================================== RCS file: /cvsroot/junit/junit/junit/tests/runner/AllTests.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AllTests.java 29 Mar 2002 16:10:13 -0000 1.2 +++ AllTests.java 9 Apr 2002 18:28:02 -0000 1.3 @@ -19,6 +19,7 @@ suite.addTestSuite(SorterTest.class); suite.addTestSuite(SimpleTestCollectorTest.class); suite.addTestSuite(BaseTestRunnerTest.class); + suite.addTestSuite(TextFeedbackTest.class); if (!BaseTestRunner.inVAJava()) { suite.addTestSuite(TextRunnerTest.class); if (!isJDK11()) |