@@ -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,13 @@ 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
+ }
115
+
116
+ private void checkSchemaIsCompatible (SchemaCompatibility .SchemaPairCompatibility compatibility ) {
117
+ assertThat (compatibility .getType ())
118
+ .withFailMessage ("Expected schema to be compatible but was not. Reason:\n %s" , compatibility .getDescription ())
119
+ .isEqualTo (SchemaCompatibility .SchemaCompatibilityType .COMPATIBLE );
114
120
}
115
121
116
122
@ Test
@@ -134,8 +140,8 @@ public void testAliasedEnumForwardsAndBackwardsCompatible() throws IOException {
134
140
SchemaCompatibility .SchemaPairCompatibility forwardsCompatibility =
135
141
SchemaCompatibility .checkReaderWriterCompatibility (newSchema , oldSchema );
136
142
//
137
- assertThat (backwardsCompatibility . getType ()). isEqualTo ( SchemaCompatibility . SchemaCompatibilityType . COMPATIBLE );
138
- assertThat (forwardsCompatibility . getType ()). isEqualTo ( SchemaCompatibility . SchemaCompatibilityType . COMPATIBLE );
143
+ checkSchemaIsCompatible (backwardsCompatibility );
144
+ checkSchemaIsCompatible (forwardsCompatibility );
139
145
}
140
146
141
147
}
0 commit comments