34
34
import org .junit .Before ;
35
35
import org .junit .internal .runners .statements .RunAfters ;
36
36
import org .junit .internal .runners .statements .RunBefores ;
37
- import org .junit .jupiter .api .RepeatedTest ;
38
37
import org .junit .rules .MethodRule ;
39
38
import org .junit .runners .model .FrameworkMethod ;
40
39
import org .junit .runners .model .Statement ;
47
46
* A JUnit method @Rule that looks at Spring repeat annotations on methods and executes the test multiple times
48
47
* (without re-initializing the test case if necessary). To avoid re-initializing use the {@link #isInitialized()}
49
48
* method to protect the @Before and @After methods.
50
- * @deprecated in favor of JUnit 5 {@link RepeatedTest}.
49
+ * @deprecated in favor of JUnit 5 {@link org.junit.jupiter.api. RepeatedTest}.
51
50
*
52
51
* @author Dave Syer
53
52
*
54
53
*/
55
54
@ Deprecated
56
55
public class RepeatProcessor implements MethodRule {
57
56
58
- private static final Log logger = LogFactory .getLog (RepeatProcessor .class );
57
+ private static final Log LOGGER = LogFactory .getLog (RepeatProcessor .class );
59
58
60
59
private final int concurrency ;
61
60
@@ -95,7 +94,7 @@ public void evaluate() throws Throwable {
95
94
try {
96
95
base .evaluate ();
97
96
}
98
- catch (Throwable t ) {
97
+ catch (Throwable t ) { // NOSONAR
99
98
throw new IllegalStateException (
100
99
"Failed on iteration: " + i + " of " + repeats + " (started at 0)" , t );
101
100
}
@@ -107,7 +106,7 @@ public void evaluate() throws Throwable {
107
106
}
108
107
};
109
108
}
110
- return new Statement () {
109
+ return new Statement () { // NOSONAR
111
110
@ Override
112
111
public void evaluate () throws Throwable {
113
112
List <Future <Boolean >> results = new ArrayList <Future <Boolean >>();
@@ -122,7 +121,7 @@ public Boolean call() {
122
121
try {
123
122
base .evaluate ();
124
123
}
125
- catch (Throwable t ) {
124
+ catch (Throwable t ) { // NOSONAR
126
125
throw new IllegalStateException ("Failed on iteration: " + count , t );
127
126
}
128
127
return true ;
@@ -147,15 +146,15 @@ private void finalizeIfNecessary(Object target) {
147
146
List <FrameworkMethod > afters = new TestClass (target .getClass ()).getAnnotatedMethods (After .class );
148
147
try {
149
148
if (!afters .isEmpty ()) {
150
- logger .debug ("Running @After methods" );
149
+ LOGGER .debug ("Running @After methods" );
151
150
try {
152
151
new RunAfters (new Statement () {
153
152
@ Override
154
153
public void evaluate () {
155
154
}
156
155
}, afters , target ).evaluate ();
157
156
}
158
- catch (Throwable e ) {
157
+ catch (Throwable e ) { // NOSONAR
159
158
fail ("Unexpected throwable " + e );
160
159
}
161
160
}
@@ -169,15 +168,15 @@ private void initializeIfNecessary(Object target) {
169
168
TestClass testClass = new TestClass (target .getClass ());
170
169
List <FrameworkMethod > befores = testClass .getAnnotatedMethods (Before .class );
171
170
if (!befores .isEmpty ()) {
172
- logger .debug ("Running @Before methods" );
171
+ LOGGER .debug ("Running @Before methods" );
173
172
try {
174
173
new RunBefores (new Statement () {
175
174
@ Override
176
175
public void evaluate () {
177
176
}
178
177
}, befores , target ).evaluate ();
179
178
}
180
- catch (Throwable e ) {
179
+ catch (Throwable e ) { // NOSONAR
181
180
fail ("Unexpected throwable " + e );
182
181
}
183
182
this .initialized = true ;
0 commit comments