use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class ImplicitParametersTest method applyImplicitParametersTest.
@Test(dataProvider = "resourceWithAnnotations")
public void applyImplicitParametersTest(String methodName, int expected) throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContext();
extension.applyImplicitParameters(context, operation, findMethod(context, methodName));
Assert.assertEquals(operation.getParameters().size(), expected);
}
use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class OperationIdTest method applyOperationIdTest.
@Test(dataProvider = "resourceWithNickname")
public void applyOperationIdTest(String methodName, String expected) throws NoSuchMethodException {
final Operation operation = new Operation();
extension.applyOperationId(operation, ResourceWithAnnotations.class.getMethod(methodName));
Assert.assertEquals(operation.getOperationId(), expected);
}
use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class ParametersTest method applyParametersTest.
@Test
public void applyParametersTest() {
final Operation operation = new Operation();
extension.applyParameters(createDefaultContext(), operation, String.class, new Annotation[] {});
Assert.assertEquals(operation.getParameters().size(), 0);
}
use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class ResponsesTest method applyResponsesTest.
@Test(dataProvider = "resourceWithAnnotations")
public void applyResponsesTest(String methodName, Response expected) throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContext();
extension.applyResponses(context, operation, findMethod(context, methodName));
if (expected == null) {
Assert.assertNull(operation.getResponses());
} else {
final Response response = operation.getResponses().get("200");
Assert.assertEquals(response.getDescription(), expected.getDescription());
}
}
use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class ResponsesTest method detailedResponsesTest.
@Test
public void detailedResponsesTest() throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContext();
extension.applyResponses(context, operation, findMethod(context, "testMethod3"));
final Map<String, Response> responses = operation.getResponses();
Assert.assertEquals(responses.size(), 7);
for (Map.Entry<String, String> entry : ResponsesTest.responses.entrySet()) {
Assert.assertEquals(responses.get(entry.getKey()).getDescription(), entry.getValue());
}
}
Aggregations