50908
|
1 |
/*
|
|
2 |
* Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*/
|
|
23 |
package com.oracle.mxtool.junit;
|
|
24 |
|
|
25 |
import java.io.*;
|
|
26 |
|
|
27 |
import org.junit.internal.*;
|
|
28 |
import org.junit.runner.*;
|
|
29 |
import org.junit.runner.notification.*;
|
|
30 |
|
|
31 |
interface MxRunListener {
|
|
32 |
|
|
33 |
/**
|
|
34 |
* Called before any tests have been run.
|
|
35 |
*
|
|
36 |
* @param description describes the tests to be run
|
|
37 |
*/
|
|
38 |
default void testRunStarted(Description description) {
|
|
39 |
}
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Called when all tests have finished.
|
|
43 |
*
|
|
44 |
* @param result the summary of the test run, including all the tests that failed
|
|
45 |
*/
|
|
46 |
default void testRunFinished(Result result) {
|
|
47 |
}
|
|
48 |
|
|
49 |
/**
|
|
50 |
* Called when a test class is about to be started.
|
|
51 |
*
|
|
52 |
* @param clazz the test class
|
|
53 |
*/
|
|
54 |
default void testClassStarted(Class<?> clazz) {
|
|
55 |
}
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Called when all tests of a test class have finished.
|
|
59 |
*
|
|
60 |
* @param clazz the test class
|
|
61 |
* @param numPassed number of tests in {@code clazz} that passed
|
|
62 |
* @param numFailed number of tests in {@code clazz} that failed
|
|
63 |
*/
|
|
64 |
default void testClassFinished(Class<?> clazz, int numPassed, int numFailed) {
|
|
65 |
}
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Called when an atomic test is about to be started. This is also called for ignored tests.
|
|
69 |
*
|
|
70 |
* @param description the description of the test that is about to be run (generally a class and
|
|
71 |
* method name)
|
|
72 |
*/
|
|
73 |
default void testStarted(Description description) {
|
|
74 |
}
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Called when an atomic test has finished, whether the test succeeds, fails or is ignored.
|
|
78 |
*
|
|
79 |
* @param description the description of the test that just ran
|
|
80 |
*/
|
|
81 |
default void testFinished(Description description) {
|
|
82 |
}
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Called when an atomic test fails.
|
|
86 |
*
|
|
87 |
* @param failure describes the test that failed and the exception that was thrown
|
|
88 |
*/
|
|
89 |
default void testFailed(Failure failure) {
|
|
90 |
}
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Called when a test will not be run, generally because a test method is annotated with
|
|
94 |
* {@link org.junit.Ignore}.
|
|
95 |
*
|
|
96 |
* @param description describes the test that will not be run
|
|
97 |
*/
|
|
98 |
default void testIgnored(Description description) {
|
|
99 |
}
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Called when an atomic test succeeds.
|
|
103 |
*
|
|
104 |
* @param description describes the test that will not be run
|
|
105 |
*/
|
|
106 |
default void testSucceeded(Description description) {
|
|
107 |
}
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Called when an atomic test flags that it assumes a condition that is false.
|
|
111 |
*
|
|
112 |
* @param failure describes the test that failed and the {@link AssumptionViolatedException}
|
|
113 |
* that was thrown
|
|
114 |
*/
|
|
115 |
default void testAssumptionFailure(Failure failure) {
|
|
116 |
}
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Called after {@link #testClassFinished(Class, int, int)}.
|
|
120 |
*/
|
|
121 |
default void testClassFinishedDelimiter() {
|
|
122 |
}
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Called after {@link #testClassStarted(Class)}.
|
|
126 |
*/
|
|
127 |
default void testClassStartedDelimiter() {
|
|
128 |
}
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Called after {@link #testStarted(Description)}.
|
|
132 |
*/
|
|
133 |
default void testStartedDelimiter() {
|
|
134 |
}
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Called after {@link #testFailed(Failure)}.
|
|
138 |
*/
|
|
139 |
default void testFinishedDelimiter() {
|
|
140 |
}
|
|
141 |
|
|
142 |
default boolean beVerbose() {
|
|
143 |
return false;
|
|
144 |
}
|
|
145 |
|
|
146 |
PrintStream getWriter();
|
|
147 |
}
|