### Question:
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();  }### Answer:
@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"); }
@Test public void testUnknownVersion() { givenNextRecordIs(defaultValues.butWithVersion((short) 999)); assertThatExceptionOfType(IORuntimeException.class) .isThrownBy(() -> readMarshallable.readMarshallable(wireInMock)) .withMessageContaining("Unsupported record version") .withMessageContaining("999"); }
@Test public void testUnknownType() { givenNextRecordIs(defaultValues.butWithType("fake-entry")); assertThatExceptionOfType(IORuntimeException.class) .isThrownBy(() -> readMarshallable.readMarshallable(wireInMock)) .withMessageContaining("Unsupported record type field") .withMessageContaining("fake-entry"); }
@Test public void testIllegalClientAddress() { givenNextRecordIs(defaultValues.butWithClientAddress(new byte[]{ 1, 2, 3 })); assertThatExceptionOfType(IORuntimeException.class) .isThrownBy(() -> readMarshallable.readMarshallable(wireInMock)) .withMessageContaining("Corrupt client_ip field"); }
@Test public void testIllegalCoordinatorAddress() { givenNextRecordIs(defaultValues.butWithCoordinatorAddress(new byte[]{ 1, 2, 3 })); assertThatExceptionOfType(IORuntimeException.class) .isThrownBy(() -> readMarshallable.readMarshallable(wireInMock)) .withMessageContaining("Corrupt coordinator_ip field"); }
@Test public void testUnknownStatus() { givenNextRecordIs(defaultValues.butWithStatus("GUCK")); assertThatExceptionOfType(IORuntimeException.class) .isThrownBy(() -> readMarshallable.readMarshallable(wireInMock)) .withMessageContaining("Corrupt record status field"); }