### Question:
EnumValueRemovalRule implements ComparingValidationRule { @Override public void enumValueRemoved(final ValidationContext ctx, final EnumValueDescriptor current, final EnumDescriptor candidateContainingEnum) { if (candidateContainingEnum.isReservedNumber(current.number()) && candidateContainingEnum.isReservedName(current.name())) { ctx.report( ViolationType.GENERATED_SOURCE_CODE_INCOMPATIBILITY_VIOLATION, "enum value made reserved" ); } else { ctx.report( ViolationType.GENERATED_SOURCE_CODE_INCOMPATIBILITY_VIOLATION, "enum value removed" ); } } private  EnumValueRemovalRule(); static EnumValueRemovalRule create(); @Override void enumValueRemoved(final ValidationContext ctx, final EnumValueDescriptor current,
                               final EnumDescriptor candidateContainingEnum);  }### Answer:
@Test public void testEnumValueRemoved() throws Exception { final DescriptorSet current = DescriptorSetUtils.buildDescriptorSet( "a.proto", "syntax = 'proto3';\n" + "enum Derp {\n" + " A = 0;\n" + " B = 1;\n" + "}" ); final DescriptorSet candidate = DescriptorSetUtils.buildDescriptorSet( "a.proto", "syntax = 'proto3';\n" + "enum Derp {\n" + " A = 0;\n" + "}" ); final ImmutableList<ValidationViolation> violations = schemaValidator.validate(current, candidate); assertThat( violations, contains( validationViolation() .type(equalTo(ViolationType.GENERATED_SOURCE_CODE_INCOMPATIBILITY_VIOLATION)) .description(equalTo("enum value removed")) ) ); }