Search in sources :

Example 1 with ModelWithEnumProperty

use of io.swagger.models.ModelWithEnumProperty in project swagger-core by swagger-api.

the class EnumPropertyTest method testExtractEnumReturnType.

@Test(description = "it should extract enum values from method return types")
public void testExtractEnumReturnType() {
    final Map<String, Model> models = ModelConverters.getInstance().read(ModelWithEnumProperty.class);
    final Model model = models.get("ModelWithEnumProperty");
    final Property enumProperty = model.getProperties().get("enumValue");
    assertTrue(enumProperty instanceof StringProperty);
    final StringProperty stringProperty = (StringProperty) enumProperty;
    assertEquals(stringProperty.getEnum(), Arrays.asList("PRIVATE", "PUBLIC", "SYSTEM", "INVITE_ONLY"));
}
Also used : Model(io.swagger.models.Model) StringProperty(io.swagger.models.properties.StringProperty) ModelWithEnumProperty(io.swagger.models.ModelWithEnumProperty) StringProperty(io.swagger.models.properties.StringProperty) Property(io.swagger.models.properties.Property) Test(org.testng.annotations.Test)

Aggregations

Model (io.swagger.models.Model)1 ModelWithEnumProperty (io.swagger.models.ModelWithEnumProperty)1 Property (io.swagger.models.properties.Property)1 StringProperty (io.swagger.models.properties.StringProperty)1 Test (org.testng.annotations.Test)1