Search in sources :

Example 46 with Test

use of org.testng.annotations.Test in project swagger-core by swagger-api.

the class SimpleReaderTest method scanResourceWithApiOperationTags.

@Test(description = "scan a resource with tags in test 841")
public void scanResourceWithApiOperationTags() {
    Swagger swagger = getSwagger(Resource841.class);
    assertEquals(swagger.getTags().size(), 3);
    List<String> rootTags = getGet(swagger, "/fun").getTags();
    assertEquals(rootTags.size(), 2);
    assertEquals(rootTags, Arrays.asList("tag1", "tag2"));
    List<String> thisTags = getGet(swagger, "/fun/this").getTags();
    assertEquals(thisTags.size(), 1);
    assertEquals(thisTags, Arrays.asList("tag1"));
    List<String> thatTags = getGet(swagger, "/fun/that").getTags();
    assertEquals(thatTags.size(), 1);
    assertEquals(thatTags, Arrays.asList("tag2"));
}
Also used : Swagger(io.swagger.models.Swagger) Test(org.testng.annotations.Test)

Example 47 with Test

use of org.testng.annotations.Test in project swagger-core by swagger-api.

the class SwaggerContextServiceTest method initializeAndGetConfigWithoutServletConfig.

@Test(description = "should add SwaggerConfig to SwaggerConfigLocator map with key CONFIG_ID_DEFAULT")
public void initializeAndGetConfigWithoutServletConfig() {
    new SwaggerContextService().initConfig();
    new SwaggerContextService().initConfig();
    verify(servletConfig1, never()).getInitParameter(eq(CONFIG_ID_KEY));
    verify(servletConfig2, never()).getInitParameter(eq(CONFIG_ID_KEY));
}
Also used : SwaggerContextService(io.swagger.jaxrs.config.SwaggerContextService) Test(org.testng.annotations.Test)

Example 48 with Test

use of org.testng.annotations.Test in project swagger-core by swagger-api.

the class SwaggerScannerLocatorTest method putConfigSecondTime.

@Test(description = "shouldn't add given scanner to map because already set")
public void putConfigSecondTime() {
    putScannerFirstTime();
    Scanner scanner = new Scanner() {

        @Override
        public Set<Class<?>> classes() {
            return null;
        }

        @Override
        public boolean getPrettyPrint() {
            return false;
        }

        @Override
        public void setPrettyPrint(boolean shouldPrettyPrint) {
        }
    };
    SwaggerScannerLocator.getInstance().putScanner(id, scanner);
    assertNotEquals(SwaggerScannerLocator.getInstance().getScanner(id), scanner);
}
Also used : Scanner(io.swagger.config.Scanner) Test(org.testng.annotations.Test)

Example 49 with Test

use of org.testng.annotations.Test in project swagger-core by swagger-api.

the class SwaggerScannerLocatorTest method putScannerFirstTime.

@Test(description = "should add given scanner to map ")
public void putScannerFirstTime() {
    Scanner scanner = new Scanner() {

        @Override
        public Set<Class<?>> classes() {
            return null;
        }

        @Override
        public boolean getPrettyPrint() {
            return false;
        }

        @Override
        public void setPrettyPrint(boolean shouldPrettyPrint) {
        }
    };
    SwaggerScannerLocator.getInstance().putScanner(id, scanner);
    assertEquals(SwaggerScannerLocator.getInstance().getScanner(id), scanner);
}
Also used : Scanner(io.swagger.config.Scanner) Test(org.testng.annotations.Test)

Example 50 with Test

use of org.testng.annotations.Test in project swagger-core by swagger-api.

the class SimpleReaderTest method scanClassWithImplicitExampleQuery.

@Test(description = "scan a resource with implicit operation query example")
public void scanClassWithImplicitExampleQuery() {
    Swagger swagger = getSwagger(ClassWithExamplePost.class);
    Parameter param = swagger.getPaths().get("/external/info2").getGet().getParameters().get(0);
    QueryParameter bp = (QueryParameter) param;
    assertNotNull(bp.getExample());
    Object value = bp.getExample();
    assertEquals("77", value);
}
Also used : QueryParameter(io.swagger.models.parameters.QueryParameter) Swagger(io.swagger.models.Swagger) SerializableParameter(io.swagger.models.parameters.SerializableParameter) PathParameter(io.swagger.models.parameters.PathParameter) Parameter(io.swagger.models.parameters.Parameter) QueryParameter(io.swagger.models.parameters.QueryParameter) BodyParameter(io.swagger.models.parameters.BodyParameter) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)27231 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2438 Task (com.evolveum.midpoint.task.api.Task)2069 ArrayList (java.util.ArrayList)1583 File (java.io.File)1530 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)1188 HashMap (java.util.HashMap)1134 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)1078 BeforeTest (org.testng.annotations.BeforeTest)870 Issue (io.qameta.allure.Issue)857 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)814 List (java.util.List)748 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)692 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)690 Response (javax.ws.rs.core.Response)682 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)651 HashSet (java.util.HashSet)631 BigDecimal (java.math.BigDecimal)627 Parameters (org.testng.annotations.Parameters)608 BaseTest (org.xdi.oxauth.BaseTest)582