use of org.apache.servicecomb.swagger.invocation.schemas.SpringmvcAddWrapperV2 in project java-chassis by ServiceComb.
the class TestSpringmvcV2V2 method addBody_addWrapper.
@Test
public void addBody_addWrapper() {
SwaggerEnvironment environment = new SwaggerEnvironment();
Swagger swagger = SwaggerGenerator.generate(SpringmvcAddWrapperV2.class);
SwaggerConsumer swaggerConsumer = environment.createConsumer(ConsumerAddBodyV2.class, swagger);
ArgumentsMapper mapper = swaggerConsumer.findOperation("add").getArgumentsMapper();
Map<String, Object> arguments = new HashMap<>();
arguments.put("addBody", new AddWrapperV2(1, 2, 3));
SwaggerInvocation invocation = new SwaggerInvocation();
Map<String, Object> result = mapper.invocationArgumentToSwaggerArguments(invocation, arguments);
Assert.assertEquals(3, result.size());
Assert.assertEquals(1, (int) result.get("x"));
Assert.assertEquals(2, (int) result.get("y"));
Assert.assertEquals(3, (int) result.get("x-z"));
}
Aggregations