use of org.testng.annotations.Test in project swagger-core by swagger-api.
the class ParameterSerializationTest method deserializeIntegerArrayPathParameter.
@Test(description = "it should deserialize a PathParameter with integer array ")
public void deserializeIntegerArrayPathParameter() throws IOException {
final String json = "{" + " \"in\":\"path\"," + " \"required\":true," + " \"type\":\"array\"," + " \"items\":{" + " \"type\":\"integer\"," + " \"format\":\"int32\"" + " }," + " \"collectionFormat\":\"multi\"" + "}";
final Parameter p = m.readValue(json, Parameter.class);
SerializationMatchers.assertEqualsToJson(p, json);
}
use of org.testng.annotations.Test in project swagger-core by swagger-api.
the class ParameterSerializationTest method testReadOnlyParameter.
@Test(description = "should mark a parameter as readOnly")
public void testReadOnlyParameter() throws Exception {
final QueryParameter qp = new QueryParameter().readOnly(true);
final String json = "{\"in\":\"query\",\"required\":false,\"readOnly\":true}";
SerializationMatchers.assertEqualsToJson(qp, json);
}
use of org.testng.annotations.Test in project swagger-core by swagger-api.
the class ParameterSerializationTest method deserializeEnumPathParameter.
@Test(description = "it should deserialize a path parameter with enum")
public void deserializeEnumPathParameter() throws IOException {
final String json = "{" + " \"in\":\"path\"," + " \"required\":true," + " \"items\":{" + " \"type\":\"string\"" + " }," + " \"enum\":[\"a\",\"b\",\"c\"]" + "}";
final Parameter p = m.readValue(json, Parameter.class);
SerializationMatchers.assertEqualsToJson(p, json);
assertEquals(((PathParameter) p).getEnum(), Arrays.asList("a", "b", "c"));
}
use of org.testng.annotations.Test in project swagger-core by swagger-api.
the class ParameterSerializationTest method deserializeStringArrayPathParameter.
@Test(description = "it should deserialize a PathParameter with string array")
public void deserializeStringArrayPathParameter() throws IOException {
final String json = "{" + " \"in\":\"path\"," + " \"required\":true," + " \"type\":\"array\"," + " \"items\":{" + " \"type\":\"string\"" + " }," + " \"collectionFormat\":\"multi\"" + "}";
final Parameter p = m.readValue(json, Parameter.class);
SerializationMatchers.assertEqualsToJson(p, json);
}
use of org.testng.annotations.Test in project swagger-core by swagger-api.
the class ParameterSerializationTest method deserializeQueryParameter.
@Test(description = "it should deserialize a QueryParameter")
public void deserializeQueryParameter() throws IOException {
final String json = "{\"in\":\"query\",\"required\":false,\"type\":\"string\"}";
final Parameter p = m.readValue(json, Parameter.class);
SerializationMatchers.assertEqualsToJson(p, json);
}
Aggregations