001/*
002 * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.
008 *
009 * This code is distributed in the hope that it will be useful, but WITHOUT
010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
011 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
012 * version 2 for more details (a copy is included in the LICENSE file that
013 * accompanied this code).
014 *
015 * You should have received a copy of the GNU General Public License version
016 * 2 along with this work; if not, write to the Free Software Foundation,
017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
018 *
019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
020 * or visit www.oracle.com if you need additional information or have any
021 * questions.
022 */
023package com.oracle.mxtool.junit;
024
025import java.io.*;
026
027import org.junit.internal.*;
028import org.junit.runner.*;
029import org.junit.runner.notification.*;
030
031public interface MxRunListener {
032
033    /**
034     * Called before any tests have been run.
035     *
036     * @param description describes the tests to be run
037     */
038    void testRunStarted(Description description);
039
040    /**
041     * Called when all tests have finished.
042     *
043     * @param result the summary of the test run, including all the tests that failed
044     */
045    void testRunFinished(Result result);
046
047    /**
048     * Called when a test class is about to be started.
049     *
050     * @param clazz the test class
051     */
052    void testClassStarted(Class<?> clazz);
053
054    /**
055     * Called when all tests of a test class have finished.
056     *
057     * @param clazz the test class
058     */
059    void testClassFinished(Class<?> clazz);
060
061    /**
062     * Called when an atomic test is about to be started. This is also called for ignored tests.
063     *
064     * @param description the description of the test that is about to be run (generally a class and
065     *            method name)
066     */
067    void testStarted(Description description);
068
069    /**
070     * Called when an atomic test has finished, whether the test succeeds, fails or is ignored.
071     *
072     * @param description the description of the test that just ran
073     */
074    void testFinished(Description description);
075
076    /**
077     * Called when an atomic test fails.
078     *
079     * @param failure describes the test that failed and the exception that was thrown
080     */
081    void testFailed(Failure failure);
082
083    /**
084     * Called when a test will not be run, generally because a test method is annotated with
085     * {@link org.junit.Ignore}.
086     *
087     * @param description describes the test that will not be run
088     */
089    void testIgnored(Description description);
090
091    /**
092     * Called when an atomic test succeeds.
093     *
094     * @param description describes the test that will not be run
095     */
096    void testSucceeded(Description description);
097
098    /**
099     * Called when an atomic test flags that it assumes a condition that is false.
100     *
101     * @param failure describes the test that failed and the {@link AssumptionViolatedException}
102     *            that was thrown
103     */
104    void testAssumptionFailure(Failure failure);
105
106    /**
107     * Called after {@link #testClassFinished(Class)}.
108     */
109    void testClassFinishedDelimiter();
110
111    /**
112     * Called after {@link #testClassStarted(Class)}.
113     */
114    void testClassStartedDelimiter();
115
116    /**
117     * Called after {@link #testStarted(Description)}.
118     */
119    void testStartedDelimiter();
120
121    /**
122     * Called after {@link #testFailed(Failure)}.
123     */
124    void testFinishedDelimiter();
125
126    PrintStream getWriter();
127
128}