ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/JSR166TestCase.java
(Generate patch)

Comparing jsr166/src/test/tck/JSR166TestCase.java (file contents):
Revision 1.177 by jsr166, Mon Oct 12 23:52:44 2015 UTC vs.
Revision 1.178 by jsr166, Fri Oct 23 17:34:47 2015 UTC

# Line 273 | Line 273 | public class JSR166TestCase extends Test
273          main(suite(), args);
274      }
275  
276 +    static class PithyResultPrinter extends junit.textui.ResultPrinter {
277 +        PithyResultPrinter(java.io.PrintStream writer) { super(writer); }
278 +        long runTime;
279 +        public void startTest(Test test) {}
280 +        protected void printHeader(long runTime) {
281 +            this.runTime = runTime; // defer printing for later
282 +        }
283 +        protected void printFooter(TestResult result) {
284 +            if (result.wasSuccessful()) {
285 +                getWriter().println("OK (" + result.runCount() + " tests)"
286 +                    + "  Time: " + elapsedTimeAsString(runTime));
287 +            } else {
288 +                getWriter().println("Time: " + elapsedTimeAsString(runTime));
289 +                super.printFooter(result);
290 +            }
291 +        }
292 +    }
293 +
294 +    /**
295 +     * Returns a TestRunner that doesn't bother with unnecessary
296 +     * fluff, like printing a "." for each test case.
297 +     */
298 +    static junit.textui.TestRunner newPithyTestRunner() {
299 +        junit.textui.TestRunner runner = new junit.textui.TestRunner();
300 +        runner.setPrinter(new PithyResultPrinter(System.out));
301 +        return runner;
302 +    }
303 +
304      /**
305       * Runs all unit tests in the given test suite.
306       * Actual behavior influenced by jsr166.* system properties.
# Line 284 | Line 312 | public class JSR166TestCase extends Test
312              System.setSecurityManager(new SecurityManager());
313          }
314          for (int i = 0; i < suiteRuns; i++) {
315 <            TestResult result = junit.textui.TestRunner.run(suite);
315 >            TestResult result = newPithyTestRunner().doRun(suite);
316              if (!result.wasSuccessful())
317                  System.exit(1);
318              System.gc();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines