Search in sources :

Example 71 with Test

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

the class AuthSerializationTest method testHeaderKeyToJson.

@Test(description = "it should convert serialize a header key model")
public void testHeaderKeyToJson() throws IOException {
    final ApiKeyAuthDefinition auth = new ApiKeyAuthDefinition().name("api-key").in(In.HEADER);
    final String json = "{\"type\":\"apiKey\",\"name\":\"api-key\",\"in\":\"header\"}";
    SerializationMatchers.assertEqualsToJson(auth, json);
}
Also used : ApiKeyAuthDefinition(io.swagger.models.auth.ApiKeyAuthDefinition) Test(org.testng.annotations.Test)

Example 72 with Test

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

the class AuthSerializationTest method testImplicitAuth.

@Test(description = "it should convert serialize an oauth2 implicit flow model")
public void testImplicitAuth() throws IOException {
    final OAuth2Definition auth = new OAuth2Definition().implicit("http://foo.com/authorization");
    final String json = "{\"type\":\"oauth2\",\"authorizationUrl\":\"http://foo.com/authorization\",\"flow\":\"implicit\"}";
    SerializationMatchers.assertEqualsToJson(auth, json);
}
Also used : OAuth2Definition(io.swagger.models.auth.OAuth2Definition) Test(org.testng.annotations.Test)

Example 73 with Test

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

the class ModelConverterTest method ignoreHiddenFields.

@Test(description = "it should ignore hidden fields")
public void ignoreHiddenFields() {
    final Map<String, Model> schemas = readAll(ClientOptInput.class);
    final Model model = schemas.get("ClientOptInput");
    assertEquals(model.getProperties().size(), 2);
}
Also used : AbstractModelWithApiModel(io.swagger.models.composition.AbstractModelWithApiModel) Model(io.swagger.models.Model) ModelWithApiModel(io.swagger.models.ModelWithApiModel) EmptyModel(io.swagger.models.EmptyModel) JodaDateTimeModel(io.swagger.models.JodaDateTimeModel) JacksonReadonlyModel(io.swagger.models.JacksonReadonlyModel) Test(org.testng.annotations.Test)

Example 74 with Test

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

the class ModelConverterTest method scanEmptyModel.

@Test(description = "it should scan an empty model per 499")
public void scanEmptyModel() {
    final Map<String, Model> schemas = readAll(EmptyModel.class);
    final ModelImpl model = (ModelImpl) schemas.get("EmptyModel");
    assertNull(model.getProperties());
    assertEquals(model.getType(), "object");
}
Also used : AbstractModelWithApiModel(io.swagger.models.composition.AbstractModelWithApiModel) Model(io.swagger.models.Model) ModelWithApiModel(io.swagger.models.ModelWithApiModel) EmptyModel(io.swagger.models.EmptyModel) JodaDateTimeModel(io.swagger.models.JodaDateTimeModel) JacksonReadonlyModel(io.swagger.models.JacksonReadonlyModel) ModelImpl(io.swagger.models.ModelImpl) Test(org.testng.annotations.Test)

Example 75 with Test

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

the class ModelConverterTest method formatDate.

@Test
public void formatDate() {
    final Map<String, Model> models = ModelConverters.getInstance().read(DateModel.class);
    final Model model = models.get("DateModel");
    assertEquals(model.getProperties().size(), 5);
    final String json = "{" + "   \"type\":\"object\"," + "   \"properties\":{" + "      \"date\":{" + "         \"type\":\"string\"," + "         \"format\":\"date-time\"," + "         \"position\":1" + "      }," + "      \"intValue\":{" + "         \"type\":\"integer\"," + "         \"format\":\"int32\"," + "         \"position\":2" + "      }," + "      \"longValue\":{" + "         \"type\":\"integer\"," + "         \"format\":\"int64\"," + "         \"position\":3" + "      }," + "      \"floatValue\":{" + "         \"type\":\"number\"," + "         \"format\":\"float\"," + "         \"position\":4" + "      }," + "      \"doubleValue\":{" + "         \"type\":\"number\"," + "         \"format\":\"double\"," + "         \"position\":5" + "      }" + "   }" + "}";
    SerializationMatchers.assertEqualsToJson(model, json);
}
Also used : AbstractModelWithApiModel(io.swagger.models.composition.AbstractModelWithApiModel) Model(io.swagger.models.Model) ModelWithApiModel(io.swagger.models.ModelWithApiModel) EmptyModel(io.swagger.models.EmptyModel) JodaDateTimeModel(io.swagger.models.JodaDateTimeModel) JacksonReadonlyModel(io.swagger.models.JacksonReadonlyModel) 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