use of org.apache.servicecomb.swagger.invocation.schemas.PojoOneArg in project java-chassis by ServiceComb.
the class TestPojoOneArg method should_mapper_swagger_wrapped_body_field_to_producer_enum.
@Test
public void should_mapper_swagger_wrapped_body_field_to_producer_enum() {
SwaggerProducer swaggerProducer = new SwaggerEnvironment().createProducer(new PojoOneArg(), null);
SwaggerProducerOperation swaggerProducerOperation = swaggerProducer.findOperation("enumBody");
Assert.assertEquals("color", swaggerProducerOperation.getSwaggerOperation().getOperation().getParameters().get(0).getName());
ProducerArgumentsMapper mapper = swaggerProducerOperation.getArgumentsMapper();
SwaggerInvocation invocation = new SwaggerInvocation();
Map<String, Object> swaggerArguments = new HashMap<>();
Map<String, Object> arguments = new HashMap<>();
arguments.put("color", "BLUE");
swaggerArguments.put("color", arguments);
Map<String, Object> result = mapper.swaggerArgumentToInvocationArguments(invocation, swaggerArguments);
Assert.assertEquals(1, result.size());
Assert.assertSame(Color.BLUE, result.get("color"));
}
Aggregations