@Test public void testReuseMarshallable() { givenNextRecordIs(defaultValues); readMarshallable.readMarshallable(wireInMock); assertThatExceptionOfType(IORuntimeException.class) .isThrownBy(() -> readMarshallable.readMarshallable(wireInMock)) .withMessageContaining("Tried to read from wire with used marshallable"); }
@Override public void readMarshallable(@NotNull WireIn wire) throws IORuntimeException { if (auditRecord != null) { throw new IORuntimeException("Tried to read from wire with used marshallable"); } short version = wire.read(WireTags.KEY_VERSION).int16(); switch (version) { case WireTags.VALUE_VERSION_0: auditRecord = readV0(wire); break; case WireTags.VALUE_VERSION_1: case WireTags.VALUE_VERSION_CURRENT: auditRecord = readBitmappedRecord(wire); break; default: throw new IORuntimeException("Unsupported record version: " + version); } }
AuditRecordReadMarshallable implements ReadMarshallable { @Override public void readMarshallable(@NotNull WireIn wire) throws IORuntimeException { if (auditRecord != null) { throw new IORuntimeException("Tried to read from wire with used marshallable"); } short version = wire.read(WireTags.KEY_VERSION).int16(); switch (version) { case WireTags.VALUE_VERSION_0: auditRecord = readV0(wire); break; case WireTags.VALUE_VERSION_1: case WireTags.VALUE_VERSION_CURRENT: auditRecord = readBitmappedRecord(wire); break; default: throw new IORuntimeException("Unsupported record version: " + version); } } }
AuditRecordReadMarshallable implements ReadMarshallable { @Override public void readMarshallable(@NotNull WireIn wire) throws IORuntimeException { if (auditRecord != null) { throw new IORuntimeException("Tried to read from wire with used marshallable"); } short version = wire.read(WireTags.KEY_VERSION).int16(); switch (version) { case WireTags.VALUE_VERSION_0: auditRecord = readV0(wire); break; case WireTags.VALUE_VERSION_1: case WireTags.VALUE_VERSION_CURRENT: auditRecord = readBitmappedRecord(wire); break; default: throw new IORuntimeException("Unsupported record version: " + version); } }  }
AuditRecordReadMarshallable implements ReadMarshallable { @Override public void readMarshallable(@NotNull WireIn wire) throws IORuntimeException { if (auditRecord != null) { throw new IORuntimeException("Tried to read from wire with used marshallable"); } short version = wire.read(WireTags.KEY_VERSION).int16(); switch (version) { case WireTags.VALUE_VERSION_0: auditRecord = readV0(wire); break; case WireTags.VALUE_VERSION_1: case WireTags.VALUE_VERSION_CURRENT: auditRecord = readBitmappedRecord(wire); break; default: throw new IORuntimeException("Unsupported record version: " + version); } }  @Override void readMarshallable(@NotNull WireIn wire); StoredAuditRecord getAuditRecord(); }
AuditRecordReadMarshallable implements ReadMarshallable { @Override public void readMarshallable(@NotNull WireIn wire) throws IORuntimeException { if (auditRecord != null) { throw new IORuntimeException("Tried to read from wire with used marshallable"); } short version = wire.read(WireTags.KEY_VERSION).int16(); switch (version) { case WireTags.VALUE_VERSION_0: auditRecord = readV0(wire); break; case WireTags.VALUE_VERSION_1: case WireTags.VALUE_VERSION_CURRENT: auditRecord = readBitmappedRecord(wire); break; default: throw new IORuntimeException("Unsupported record version: " + version); } }  @Override void readMarshallable(@NotNull WireIn wire); StoredAuditRecord getAuditRecord();  }