@Test
public void testValidEnumInParameterAndResource() throws Exception {

  @Api
  class EnumParameter {
    @SuppressWarnings("unused")
    public void pick(@Named("outcomeParam") Outcome outcome, EnumBean date) { }
  }
  String apiConfigSource = g.generateConfig(EnumParameter.class).get("myapi-v1.api");
  ObjectNode root = objectMapper.readValue(apiConfigSource, ObjectNode.class);
  JsonNode outcomeSchema = root.path("descriptor").path("schemas").path("Outcome");
  assertEquals("Outcome", outcomeSchema.path("id").asText());
  assertEquals("string", outcomeSchema.path("type").asText());
  JsonNode enumConfig = outcomeSchema.path("enum");
  assertTrue(enumConfig.isArray());
  assertEquals(3, enumConfig.size());
  assertEquals(Outcome.WON.toString(), enumConfig.get(0).asText());
  assertEquals(Outcome.LOST.toString(), enumConfig.get(1).asText());
  assertEquals(Outcome.TIE.toString(), enumConfig.get(2).asText());
  JsonNode enumSchema = root.path("descriptor").path("schemas").path("EnumBean");
  assertEquals("EnumBean", enumSchema.path("id").asText());
  assertEquals("object", enumSchema.path("type").asText());
  assertNotNull(enumSchema.get("properties"));
  assertNotNull(enumSchema.path("properties").path("outcome").get("$ref"));
  assertEquals("Outcome", enumSchema.path("properties").path("outcome").path("$ref").asText());
  JsonNode methodSchema = root.path("descriptor").path("methods").path(
      EnumParameter.class.getName() + ".pick");
  assertNotNull(methodSchema.get("request"));
  assertNotNull(methodSchema.path("request").get("$ref"));
  assertEquals("EnumBean", methodSchema.path("request").get("$ref").asText());
}