File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app157 Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import io .swagger .v3 .core .converter .ModelConverters ;
4
4
import io .swagger .v3 .core .util .Json ;
5
+ import org .junit .jupiter .api .AfterAll ;
6
+ import org .junit .jupiter .api .AfterEach ;
7
+ import org .junit .jupiter .api .BeforeAll ;
8
+ import org .junit .jupiter .api .BeforeEach ;
5
9
import org .junit .jupiter .api .Test ;
6
10
import org .springdoc .core .Constants ;
7
11
import org .springdoc .core .converters .ModelConverterRegistrar ;
@@ -26,10 +30,21 @@ public class SpringDocApp157Test extends AbstractSpringDocTest {
26
30
@ SpringBootApplication
27
31
static class SpringBootApp {}
28
32
33
+ private StringyConverter myConverter = new StringyConverter ();
34
+ private ModelConverters converters = ModelConverters .getInstance ();
35
+
36
+ @ BeforeEach
37
+ public void registerConverter () {
38
+ converters .addConverter (myConverter );
39
+ }
40
+
41
+ @ AfterEach
42
+ public void unregisterConverter () {
43
+ converters .removeConverter (myConverter );
44
+ }
45
+
29
46
@ Test
30
47
public void testApp () throws Exception {
31
- // Not sure why the converter isn't registered automatically. Register it here.
32
- new ModelConverterRegistrar (List .of (new StringyConverter ()));
33
48
mockMvc .perform (get (Constants .DEFAULT_API_DOCS_URL ))
34
49
.andExpect (status ().isOk ())
35
50
.andExpect (jsonPath ("$.openapi" , is ("3.0.1" )))
You can’t perform that action at this time.
0 commit comments