### Question:
AvroCompatibilityHelper { public static AvroVersion getRuntimeAvroVersion() { return AVRO_VERSION; } private  AvroCompatibilityHelper(); static BinaryEncoder newBinaryEncoder(OutputStream out); static Encoder newBufferedBinaryEncoder(OutputStream out); static BinaryEncoder newBinaryEncoder(ObjectOutput out); static BinaryDecoder newBinaryDecoder(InputStream in); static BinaryDecoder newBinaryDecoder(ObjectInput in); static JsonEncoder newJsonEncoder(Schema schema, OutputStream out); static JsonEncoder newJsonEncoder(Schema schema, JsonGenerator jsonGenerator); static JsonDecoder newJsonDecoder(Schema schema, InputStream input); static JsonDecoder newJsonDecoder(Schema schema, String input); static GenericData.EnumSymbol newEnumSymbol(Schema avroSchema, String enumValue); static GenericData.Fixed newFixedField(Schema ofType); static GenericData.Fixed newFixedField(Schema ofType, byte[] contents); static Object newInstance(Class clazz, Schema schema); static Schema getSchema(Type type); static Object getDefaultValue(Schema.Field field); static boolean isSpecificRecord(IndexedRecord indexedRecord); static boolean isGenericRecord(IndexedRecord indexedRecord); static Collection<AvroGeneratedSourceCode> compile(Collection<Schema> toCompile, AvroVersion compatibilityLevel); static AvroVersion getRuntimeAvroVersion(); static Schema parse(String schemaJson); static SchemaParseResult parse(String schemaJson, Collection<Schema> known); static String toParsingForm(Schema s);  }### Answer:
@Test public void testFixShortUnionBranches() throws Exception { if (!AvroCompatibilityHelper.getRuntimeAvroVersion().laterThan(AvroVersion.AVRO_1_4)) { throw new SkipException("test only valid under modern avro"); } String avsc = TestUtil.load("HasUnions.avsc"); String payload14 = TestUtil.load("HasUnions14.json"); String payload17 = TestUtil.load("HasUnions17.json"); LegacyAvroSchema schema = new LegacyAvroSchema("1234", avsc); GenericRecord deserialized14 = schema.deserializeJson(payload14); Assert.assertNotNull(deserialized14); Assert.assertNotNull(deserialized14.get("f1")); GenericRecord deserialized17 = schema.deserializeJson(payload17); Assert.assertNotNull(deserialized17); Assert.assertNotNull(deserialized17.get("f1")); }
@Test public void testFixFullUnionBranches() throws Exception { if (AvroCompatibilityHelper.getRuntimeAvroVersion().laterThan(AvroVersion.AVRO_1_4)) { throw new SkipException("test only valid under avro 1.4 and earlier"); } String avsc = TestUtil.load("HasUnions.avsc"); String payload14 = TestUtil.load("HasUnions14.json"); String payload17 = TestUtil.load("HasUnions17.json"); LegacyAvroSchema schema = new LegacyAvroSchema("1234", avsc); GenericRecord deserialized14 = schema.deserializeJson(payload14); Assert.assertNotNull(deserialized14); Assert.assertNotNull(deserialized14.get("f1")); GenericRecord deserialized17 = schema.deserializeJson(payload17); Assert.assertNotNull(deserialized17); Assert.assertNotNull(deserialized17.get("f1")); }