public void testParseBadEnumDefinitionWithMissingColon() throws Exception {
   writeTestProto("enum Response {", "  YES = 0;", "  NO = 1", "};");
   ProtoEnumDefinition enumDef = getOnlyTopLevelEnumeration();
   assertNotNull(enumDef);
   assertNoError(enumDef.getConstants().get(0));
   assertError(enumDef.getConstants().get(1), "expected ';' or ','");
 }
  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");
  }
 public void testParseEnumWithoutComma() throws Exception {
   writeTestProto("package foo;", "enum Foo {", "  Bar1 = 1", "  Bar2 = 2,", "}");
   assertPackageName(protoFile, "foo");
   ProtoEnumDefinition foo = getOnlyTopLevelEnumeration();
   List<ProtoEnumConstant> constVals = foo.getConstants();
   assertError(constVals.get(0), "expected ';' or ','");
 }
 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 '}'");
 }