AvroSnapshotSerializer's protocol version validation is flawed:
The testSerDesProtocolVersionAsMoreThan127 is working most of the time, because there are just 6 serdes protocol handlers, and the SerDesProtocolHandlerRegistry.get().getSerDesProtocolHandler(protocolVersion)throws an Avro exception. (There is a 6/256 chance that test won't pass, for example if nexInt is 0) The provided Number (that is larger than 127, and sometimes smaller bacause of the overflow, is internally casted to a byte)
AvroSnapshotSerializer's protocol version validation is flawed:
The testSerDesProtocolVersionAsMoreThan127 is working most of the time, because there are just 6 serdes protocol handlers, and the SerDesProtocolHandlerRegistry.get().getSerDesProtocolHandler(protocolVersion)throws an Avro exception. (There is a 6/256 chance that test won't pass, for example if nexInt is 0) The provided Number (that is larger than 127, and sometimes smaller bacause of the overflow, is internally casted to a byte)