Code example for TestResult

Methods: runCount, wasSuccessful

0
 
 
    abstract static class DisplayedResultsFormatter extends ResultsFormatter { 
 
        protected void displayHeader( PrintWriter writer, String testClassName, TestResult testResult, String elapsedTimeString ) {
            displayHeader( writer, testClassName, getFormatted( testResult.runCount(), "test" ),
                                   elapsedTimeString, testResult.wasSuccessful() ? "OK" : "Problems Occurred" );
        } 
 
        protected void displayResults( PrintWriter writer, TestResult testResult ) {
            if (!testResult.wasSuccessful()) {
                displayProblems( writer, "failure", testResult.failureCount(), testResult.failures() );
                displayProblems( writer, "error", testResult.errorCount(), testResult.errors() );
            } 
        } 
 
 
        protected abstract void displayHeader( PrintWriter writer, String testClassName, String testCountText, String elapsedTimeString, String resultString );
 
 
        protected abstract void displayProblemTitle( PrintWriter writer, String title );