@Test
public void testSchemaVersion() throws KeyTypeNotImplementedException
{

  final short SCHEMA_VERSION = 152;
  String randomValue = RngUtils.randomString(20);
  ByteBuffer serializationBuffer = ByteBuffer.allocate(1000).order(_eventV1Factory.getByteOrder());
  // simulate having a schemaid and overwriting the first 2 bytes with schemaVersion
  ByteBuffer buffer = ByteBuffer.allocate(16);
  buffer.put(schemaId);
  buffer.flip();
  // now use first two bytes for schema version
  buffer.putShort(SCHEMA_VERSION);
  buffer.flip();
  byte [] schemaVersion = buffer.array();
  DbusEventInfo eventInfo = new DbusEventInfo(DbusOpcode.UPSERT, 0L, (short)0, partitionId, timeStamp, srcId,
                                              schemaVersion, randomValue.getBytes(Charset.defaultCharset()), false, false);
  eventInfo.setEventSerializationVersion(DbusEventFactory.DBUS_EVENT_V1);  // make this explicit
  DbusEventFactory.serializeEvent(new DbusEventKey(key), serializationBuffer, eventInfo);
  DbusEventInternalReadable e = _eventV1Factory.createReadOnlyDbusEventFromBuffer(serializationBuffer, 0);
  assertEquals("SchemaVersion matches", SCHEMA_VERSION,e.schemaVersion());
  assertTrue("SchemaId doesn't match", !Arrays.equals(schemaId, e.schemaId()));
  assertTrue("SchemaId (14 bytes) matches",
             Arrays.equals(Arrays.copyOfRange(schemaId, 2, schemaId.length),
                           Arrays.copyOfRange(e.schemaId(), 2, schemaId.length)));
}