Search in sources :

Example 6 with SwaggerGeneratorForTest

use of io.servicecomb.swagger.generator.core.unittest.SwaggerGeneratorForTest in project java-chassis by ServiceComb.

the class TestProperty method testStringProperty.

@Test
public void testStringProperty() {
    SwaggerGenerator generator = new SwaggerGeneratorForTest(context, null);
    List<String> enums = Arrays.asList("testStringProperty_a", "testStringProperty_b");
    StringProperty sp = new StringProperty();
    sp._enum(enums);
    StringPropertyConverter spc = new StringPropertyConverter();
    JavaType jt = spc.convert(generator.getClassLoader(), generator.ensureGetPackageName(), generator.getSwagger(), sp);
    StringProperty spNew = (StringProperty) ModelConverters.getInstance().readAsProperty(jt);
    Assert.assertEquals(enums, spNew.getEnum());
}
Also used : JavaType(com.fasterxml.jackson.databind.JavaType) StringProperty(io.swagger.models.properties.StringProperty) StringPropertyConverter(io.servicecomb.swagger.converter.property.StringPropertyConverter) SwaggerGeneratorForTest(io.servicecomb.swagger.generator.core.unittest.SwaggerGeneratorForTest) SwaggerGeneratorForTest(io.servicecomb.swagger.generator.core.unittest.SwaggerGeneratorForTest) Test(org.junit.Test)

Aggregations

SwaggerGeneratorForTest (io.servicecomb.swagger.generator.core.unittest.SwaggerGeneratorForTest)6 Test (org.junit.Test)6 Swagger (io.swagger.models.Swagger)5 JavaType (com.fasterxml.jackson.databind.JavaType)3 StringPropertyConverter (io.servicecomb.swagger.converter.property.StringPropertyConverter)1 Model (io.swagger.models.Model)1 Operation (io.swagger.models.Operation)1 Path (io.swagger.models.Path)1 RefModel (io.swagger.models.RefModel)1 Parameter (io.swagger.models.parameters.Parameter)1 StringProperty (io.swagger.models.properties.StringProperty)1 Map (java.util.Map)1