Search in sources :

Example 41 with Test

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

the class ReaderTest method scanBeanValidation.

@Test(description = "it should scan parameters with Swagger and JSR-303 bean validation annotations")
public void scanBeanValidation() {
    Swagger swagger = getSwagger(ResourceWithValidation.class);
    assertNotNull(swagger);
    QueryParameter par = (QueryParameter) swagger.getPaths().get("/303").getOperations().get(0).getParameters().get(0);
    assertTrue(par.getRequired());
    assertEquals(par.getMinimum(), new BigDecimal(10));
    par = (QueryParameter) swagger.getPaths().get("/swagger-and-303").getOperations().get(0).getParameters().get(0);
    assertTrue(par.getRequired());
    assertEquals(par.getMinimum(), new BigDecimal(7));
    par = (QueryParameter) swagger.getPaths().get("/swagger").getOperations().get(0).getParameters().get(0);
    assertTrue(par.getRequired());
    assertEquals(par.getMinimum(), new BigDecimal(7));
}
Also used : QueryParameter(io.swagger.models.parameters.QueryParameter) Swagger(io.swagger.models.Swagger) BigDecimal(java.math.BigDecimal) Test(org.testng.annotations.Test)

Example 42 with Test

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

the class ResourceTest1343 method scanResource1343.

@Test(description = "scan resource 1343")
public void scanResource1343() {
    Swagger swagger = getSwagger(Resource1343.class);
    assertNotNull(swagger);
}
Also used : Swagger(io.swagger.models.Swagger) Test(org.testng.annotations.Test)

Example 43 with Test

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

the class ResourceWithSchemeTest method scanResourceWithSubresources.

@Test(description = "scan another resource with subresources")
public void scanResourceWithSubresources() {
    Swagger swagger = getSwagger(ResourceWithScheme.class);
    assertEquals(loadSchemes(swagger, "/test/status"), Arrays.asList(Scheme.HTTPS));
    assertEquals(loadSchemes(swagger, "/test/value"), Arrays.asList(Scheme.WS, Scheme.WSS));
    assertEquals(loadSchemes(swagger, "/test/notes"), Arrays.asList(Scheme.HTTP));
    assertEquals(loadSchemes(swagger, "/test/description"), Arrays.asList(Scheme.HTTP));
}
Also used : Swagger(io.swagger.models.Swagger) Test(org.testng.annotations.Test)

Example 44 with Test

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

the class SimpleReaderTest method scanClassWithExamplePostClass.

@Test(description = "scan a resource with operation post example (dataTypeClass)")
public void scanClassWithExamplePostClass() {
    Swagger swagger = getSwagger(ClassWithExamplePostClass.class);
    Parameter param = swagger.getPaths().get("/external/info").getPost().getParameters().get(0);
    BodyParameter bp = (BodyParameter) param;
    assertNotNull(bp.getExamples());
    assertTrue(bp.getExamples().size() == 1);
    String value = bp.getExamples().get("application/json");
    assertEquals("[\"a\",\"b\"]", value);
}
Also used : 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) BodyParameter(io.swagger.models.parameters.BodyParameter) Test(org.testng.annotations.Test)

Example 45 with Test

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

the class SimpleReaderTest method scanResourceWithMapReturnType.

@Test(description = "scan a resource with map return type")
public void scanResourceWithMapReturnType() {
    Swagger swagger = getSwagger(ResourceWithMapReturnValue.class);
    Operation get = getGet(swagger, "/{id}");
    assertNotNull(get);
    assertNotNull(get.getResponses());
    Response response = get.getResponses().get("200");
    assertNotNull(response);
    Property schema = response.getSchema();
    assertEquals(schema.getClass(), MapProperty.class);
}
Also used : ResourceWithResponse(io.swagger.resources.ResourceWithResponse) Response(io.swagger.models.Response) Swagger(io.swagger.models.Swagger) Operation(io.swagger.models.Operation) NicknamedOperation(io.swagger.resources.NicknamedOperation) StringProperty(io.swagger.models.properties.StringProperty) ArrayProperty(io.swagger.models.properties.ArrayProperty) Property(io.swagger.models.properties.Property) MapProperty(io.swagger.models.properties.MapProperty) RefProperty(io.swagger.models.properties.RefProperty) IntegerProperty(io.swagger.models.properties.IntegerProperty) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)25872 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2438 Task (com.evolveum.midpoint.task.api.Task)2069 File (java.io.File)1464 ArrayList (java.util.ArrayList)1408 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)1188 HashMap (java.util.HashMap)1089 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)1078 Issue (io.qameta.allure.Issue)857 BeforeTest (org.testng.annotations.BeforeTest)819 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)814 List (java.util.List)734 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)676 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)651 BigDecimal (java.math.BigDecimal)627 Parameters (org.testng.annotations.Parameters)608 BaseTest (org.xdi.oxauth.BaseTest)582 HashSet (java.util.HashSet)568