@@ -66,7 +66,7 @@ public void testAliasedRecordForwardsCompatible() throws IOException {
66
66
SchemaCompatibility .SchemaPairCompatibility compatibility =
67
67
SchemaCompatibility .checkReaderWriterCompatibility (newSchema , oldSchema );
68
68
//
69
- assertThat (compatibility . getType ()). isEqualTo ( SchemaCompatibility . SchemaCompatibilityType . COMPATIBLE );
69
+ checkSchemaIsCompatible (compatibility );
70
70
}
71
71
72
72
@ Test
@@ -88,7 +88,7 @@ public void testAliasedRecordForwardsCompatibleSameNamespace() throws IOExceptio
88
88
SchemaCompatibility .SchemaPairCompatibility compatibility =
89
89
SchemaCompatibility .checkReaderWriterCompatibility (newSchema , oldSchema );
90
90
//
91
- assertThat (compatibility . getType ()). isEqualTo ( SchemaCompatibility . SchemaCompatibilityType . COMPATIBLE );
91
+ checkSchemaIsCompatible (compatibility );
92
92
}
93
93
94
94
@ Test
@@ -110,7 +110,7 @@ public void testAliasedEnumForwardsCompatible() throws IOException {
110
110
SchemaCompatibility .SchemaPairCompatibility compatibility =
111
111
SchemaCompatibility .checkReaderWriterCompatibility (newSchema , oldSchema );
112
112
//
113
- assertThat (compatibility . getType ()). isEqualTo ( SchemaCompatibility . SchemaCompatibilityType . COMPATIBLE );
113
+ checkSchemaIsCompatible (compatibility );
114
114
}
115
115
116
116
@ Test
@@ -134,8 +134,14 @@ public void testAliasedEnumForwardsAndBackwardsCompatible() throws IOException {
134
134
SchemaCompatibility .SchemaPairCompatibility forwardsCompatibility =
135
135
SchemaCompatibility .checkReaderWriterCompatibility (newSchema , oldSchema );
136
136
//
137
- assertThat (backwardsCompatibility .getType ()).isEqualTo (SchemaCompatibility .SchemaCompatibilityType .COMPATIBLE );
138
- assertThat (forwardsCompatibility .getType ()).isEqualTo (SchemaCompatibility .SchemaCompatibilityType .COMPATIBLE );
137
+ checkSchemaIsCompatible (backwardsCompatibility );
138
+ checkSchemaIsCompatible (forwardsCompatibility );
139
+ }
140
+
141
+ private void checkSchemaIsCompatible (SchemaCompatibility .SchemaPairCompatibility compatibility ) {
142
+ assertThat (compatibility .getType ())
143
+ .withFailMessage ("Expected schema to be compatible but was not. Reason:\n %s" , compatibility .getDescription ())
144
+ .isEqualTo (SchemaCompatibility .SchemaCompatibilityType .COMPATIBLE );
139
145
}
140
146
141
147
}
0 commit comments