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 22
33import io .swagger .v3 .core .converter .ModelConverters ;
44import 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 ;
59import org .junit .jupiter .api .Test ;
610import org .springdoc .core .Constants ;
711import org .springdoc .core .converters .ModelConverterRegistrar ;
@@ -26,10 +30,21 @@ public class SpringDocApp157Test extends AbstractSpringDocTest {
2630 @ SpringBootApplication
2731 static class SpringBootApp {}
2832
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+
2946 @ Test
3047 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 ()));
3348 mockMvc .perform (get (Constants .DEFAULT_API_DOCS_URL ))
3449 .andExpect (status ().isOk ())
3550 .andExpect (jsonPath ("$.openapi" , is ("3.0.1" )))
You can’t perform that action at this time.
0 commit comments