|
2 | 2 |
|
3 | 3 | import com.fasterxml.jackson.annotation.JsonInclude;
|
4 | 4 | import com.fasterxml.jackson.databind.JsonNode;
|
| 5 | + |
| 6 | +import io.swagger.v3.core.converter.ModelConverter; |
| 7 | +import io.swagger.v3.core.converter.ModelConverters; |
5 | 8 | import io.swagger.v3.core.util.Yaml;
|
6 | 9 | import io.swagger.v3.jaxrs2.Reader;
|
7 | 10 | import io.swagger.v3.jaxrs2.matchers.SerializationMatchers;
|
8 | 11 | import io.swagger.v3.oas.models.OpenAPI;
|
9 | 12 | import org.apache.commons.io.IOUtils;
|
| 13 | +import org.testng.annotations.BeforeMethod; |
10 | 14 |
|
11 | 15 | import java.io.IOException;
|
12 | 16 | import java.io.InputStream;
|
|
15 | 19 | import static org.testng.Assert.fail;
|
16 | 20 |
|
17 | 21 | public abstract class AbstractAnnotationTest {
|
| 22 | + @BeforeMethod |
| 23 | + public void beforeTest() { |
| 24 | + ModelConverters.getInstance().resetContext(); |
| 25 | + } |
| 26 | + |
18 | 27 | public String readIntoYaml(final Class<?> cls) {
|
19 | 28 | Reader reader = new Reader(new OpenAPI());
|
20 | 29 | OpenAPI openAPI = reader.read(cls);
|
@@ -42,6 +51,7 @@ public void compareToYamlFile(final Class<?> cls, String source){
|
42 | 51 | }
|
43 | 52 |
|
44 | 53 | public void compareAsYaml(final Class<?> cls, final String yaml) throws IOException {
|
| 54 | + ModelConverters.getInstance().resetContext(); |
45 | 55 | Reader reader = new Reader(new OpenAPI());
|
46 | 56 | OpenAPI openAPI = reader.read(cls);
|
47 | 57 | SerializationMatchers.assertEqualsToYaml(openAPI, yaml);
|
|
0 commit comments