public void testParseEnumsWithInvalidFieldOption() throws Exception {
    writeTestProto("enum Response {", "    YES = 0 [(foo)=];", "    NO = 1;", "}");

    ProtoEnumDefinition enumDef = getOnlyTopLevelEnumeration();
    ProtoEnumBody body = enumDef.getEnumBody();
    assertError((AbstractProtoElement) body.getChildren()[0], "expected custom option value");
  }
 private void assertEnumEquals(String name, List<String> constants, ProtoEnumDefinition enumDef) {
   assertEquals(name, enumDef.getName());
   assertNotNull(enumDef.getEnumBody());
   assertAnyOrder(
       Iterables.transform(
           enumDef.getConstants(),
           new Function<ProtoEnumConstant, String>() {
             @Override
             public String apply(@Nullable ProtoEnumConstant protoEnumConstant) {
               return protoEnumConstant.getName();
             }
           }),
       constants);
 }
 public void testParseBadEnumDefinitionWithMissingRBrace() throws Exception {
   writeTestProto("enum Response {", "  YES = 0;", "  NO = 1;");
   ProtoEnumDefinition enumDef = getOnlyTopLevelEnumeration();
   assertNotNull(enumDef);
   assertError(enumDef.getEnumBody(), "expected '}'");
 }