SchemaVersionUtils { public static boolean processSchemaVersion(final byte versionByte, final int supportedVersion) { checkArgument(supportedVersion >= 0, "The supported schema version is invalid"); final int writerSchemaVersion = decodeAvroSchemaVersion(versionByte); if( writerSchemaVersion != supportedVersion ) { logger.warn(format("Cannot process unknown schema version %d, expected: %d ", writerSchemaVersion, supportedVersion)); throw new UnknownSchemaVersionException(writerSchemaVersion, supportedVersion); } return true; } private  SchemaVersionUtils(); static boolean processSchemaVersion(final byte versionByte, final int supportedVersion); static int decodeAvroSchemaVersion(final byte versionByte);  }
@Test(expected = UnknownSchemaVersionException.class) public void testProcessSchemaVersionUnsupportedVersion() { SchemaVersionUtils.processSchemaVersion((byte)0x02, 0); }
@Test(expected = IllegalArgumentException.class) public void testProcessSchemaVersionNegativeSupportedVersion() { SchemaVersionUtils.processSchemaVersion((byte)0x00, -1); }
@Test public void testProcessSchemaVersionSupportedVersion() { assertTrue(SchemaVersionUtils.processSchemaVersion((byte)0x7E, 63)); }