SchemaCompatibilityValidator implements Validator<Void> { static String diff(final Schema schema1, final Schema schema2) { String s1 = schema1.toString(true); String s2 = schema2.toString(true); DiffMatchPatch dmp = new DiffMatchPatch(); LinkedList<DiffMatchPatch.Diff> diffs = dmp.diffMain(s1, s2, false); dmp.diffCleanupSemantic(diffs); StringBuilder result = new StringBuilder(); for (DiffMatchPatch.Diff aDiff : diffs) { String text = aDiff.text; switch (aDiff.operation) { case INSERT: result.append("+<<<").append(text).append(">>>"); break; case DELETE: result.append("-<<<").append(text).append(">>>"); break; case EQUAL: result.append(text); break; default: throw new UnsupportedOperationException("Not supported " + aDiff.operation); } } return result.toString(); }  @Override String getName(); @Override @SuppressFBWarnings("PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS") Result validate(final Void nv, final ValidatorMojo mojo); @SuppressFBWarnings("PCAIL_POSSIBLE_CONSTANT_ALLOCATION_IN_LOOP") // Schema.Parser is mutable, false positive. @SuppressWarnings("checkstyle:ParameterNumber") // valid will address later. void validateCompatibility(final String groupId, final String artifactId,
          @Nullable final String classifier, final String extension,
          final Version version,
          final List<RemoteRepository> remoteProjectRepositories,
          final RepositorySystem repoSystem,
          final RepositorySystemSession repositorySession,
          final ValidatorMojo mojo,
          final boolean deprecationRemoval,
          final Instant instantToGoBack,
          final Consumer<String> issues); void validateCompatiblityBetween2Schemas(final Schema newSchema, final Schema previousSchema,
          final Version previousVersion,
          final Consumer<String> issues, final Log log, final boolean deprecationRemoval); @Override Class<Void> getValidationInput();  }
@Test public void testDiff() { Schema rec1 = SchemaBuilder.record("test") .fields() .nullableLong("testField", 0).endRecord(); Schema rec2 = SchemaBuilder.record("test") .fields() .nullableInt("testField", 0).endRecord(); String diff = SchemaCompatibilityValidator.diff(rec1, rec2); Assert.assertThat(diff, Matchers.containsString("int")); Assert.assertThat(diff, Matchers.containsString("long")); }