### Question:
FieldRemovalRule implements ComparingValidationRule { @Override public void fieldRemoved(final ValidationContext ctx, final FieldDescriptor current, final MessageDescriptor candidateContainingMessage) { if (candidateContainingMessage.isReservedNumber(current.number()) && candidateContainingMessage.isReservedName(current.name())) { ctx.report( ViolationType.GENERATED_SOURCE_CODE_INCOMPATIBILITY_VIOLATION, "field made reserved" ); } else { ctx.report( ViolationType.GENERATED_SOURCE_CODE_INCOMPATIBILITY_VIOLATION, "field removed" ); } } private  FieldRemovalRule(); static FieldRemovalRule create(); @Override void fieldRemoved(final ValidationContext ctx,
                           final FieldDescriptor current,
                           final MessageDescriptor candidateContainingMessage);  }### Answer:
@Test public void testFieldRemoved() throws Exception { final DescriptorSet current = DescriptorSetUtils.buildDescriptorSet( "a.proto", "syntax = 'proto3';\n" + "message Derp {\n" + " int32 a = 1;\n" + "}" ); final DescriptorSet candidate = DescriptorSetUtils.buildDescriptorSet( "a.proto", "syntax = 'proto3';\n" + "message Derp {\n" + "}" ); final ImmutableList<ValidationViolation> violations = schemaValidator.validate(current, candidate); assertThat( violations, contains( validationViolation() .type(equalTo(ViolationType.GENERATED_SOURCE_CODE_INCOMPATIBILITY_VIOLATION)) .description(equalTo("field removed")) ) ); }