Code example for AssertionFailedError

0
        //the trick to integrating test output to the formatter, is to 
        //create a special test class that asserts an error 
        //and tell the formatter that it raised. 
        TestCase t = new VmExitErrorTest(message, test, testCase); 
        formatter.startTest(t); 
        formatter.addError(t, new AssertionFailedError(message)); 
        formatter.endTestSuite(test); 
    } 
 
    /** {@inheritDoc}. */ 
    public JUnitTaskMirror.JUnitTestRunnerMirror newJUnitTestRunner(JUnitTest test, 
            boolean haltOnError, boolean filterTrace, boolean haltOnFailure, 
            boolean showOutput, boolean logTestListenerEvents, AntClassLoader classLoader) { 
        return new JUnitTestRunner(test, haltOnError, filterTrace, haltOnFailure, 
                showOutput, logTestListenerEvents, classLoader); 
    } 
 
    /** {@inheritDoc}. */ 
    public JUnitTaskMirror.SummaryJUnitResultFormatterMirror newSummaryJUnitResultFormatter() { 
        return new SummaryJUnitResultFormatter(); 
    }