1
1
package org .wiremock .spring .internal ;
2
2
3
3
import com .github .tomakehurst .wiremock .WireMockServer ;
4
+ import com .github .tomakehurst .wiremock .client .WireMock ;
4
5
import java .lang .annotation .Annotation ;
5
6
import java .lang .reflect .Field ;
6
7
import java .util .List ;
7
8
import java .util .function .Function ;
9
+ import org .junit .jupiter .api .extension .AfterEachCallback ;
8
10
import org .junit .jupiter .api .extension .BeforeEachCallback ;
9
11
import org .junit .jupiter .api .extension .ExtensionContext ;
10
12
import org .junit .jupiter .api .extension .ParameterContext ;
18
20
*
19
21
* @author Maciej Walkowiak
20
22
*/
21
- public class WireMockSpringExtension implements BeforeEachCallback , ParameterResolver {
23
+ public class WireMockSpringExtension
24
+ implements BeforeEachCallback , AfterEachCallback , ParameterResolver {
22
25
23
26
@ Override
24
27
public void beforeEach (final ExtensionContext extensionContext ) throws Exception {
@@ -29,6 +32,11 @@ public void beforeEach(final ExtensionContext extensionContext) throws Exception
29
32
injectWireMockInstances (extensionContext , InjectWireMock .class , InjectWireMock ::value );
30
33
}
31
34
35
+ @ Override
36
+ public void afterEach (final ExtensionContext context ) throws Exception {
37
+ WireMock .configureFor (8080 );
38
+ }
39
+
32
40
private static <T extends Annotation > void injectWireMockInstances (
33
41
final ExtensionContext extensionContext ,
34
42
final Class <T > annotation ,
0 commit comments