Search in sources :

Example 1 with OASFilter

use of org.eclipse.microprofile.openapi.OASFilter in project wildfly-swarm by wildfly-swarm.

the class FilterUtilTest method testApplyFilter.

/**
 * Test method for {@link org.wildfly.swarm.microprofile.openapi.api.util.FilterUtil#applyFilter(org.eclipse.microprofile.openapi.OASFilter, org.eclipse.microprofile.openapi.models.OpenAPI)}.
 * @throws Exception
 */
@Test
public void testApplyFilter() throws Exception {
    URL beforeUrl = FilterUtilTest.class.getResource("filter-before.json");
    URL afterUrl = FilterUtilTest.class.getResource("filter-after.json");
    OpenAPIImpl model = OpenApiParser.parse(beforeUrl);
    OASFilter filter = filter();
    model = (OpenAPIImpl) FilterUtil.applyFilter(filter, model);
    String actual = OpenApiSerializer.serialize(model, Format.JSON);
    String expected = loadResource(afterUrl);
    assertJsonEquals(expected, actual);
}
Also used : OASFilter(org.eclipse.microprofile.openapi.OASFilter) OpenAPIImpl(org.wildfly.swarm.microprofile.openapi.api.models.OpenAPIImpl) URL(java.net.URL) Test(org.junit.Test)

Aggregations

URL (java.net.URL)1 OASFilter (org.eclipse.microprofile.openapi.OASFilter)1 Test (org.junit.Test)1 OpenAPIImpl (org.wildfly.swarm.microprofile.openapi.api.models.OpenAPIImpl)1