### Question:
SerializedEvent { public InputStream asInputStream() { return new ByteArrayInputStream(serializedData); } SerializedEvent(Event event);  SerializedEvent(byte[] eventFromFile);  SerializedEvent(InputStream event); InputStream asInputStream(); Event asEvent(); int size(); byte[] serializedData(); long getAggregateSequenceNumber(); byte[] getPayload(); String getIdentifier(); String getAggregateType(); String getPayloadType(); String getPayloadRevision(); long getTimestamp(); boolean isDomainEvent(); String getAggregateIdentifier(); long getSequenceNumber(); String getType(); Map<String, Object> getMetaData(); @Override boolean equals(Object o); @Override int hashCode(); ByteString asByteString();  }### Answer:
@Test public void asInputStream() throws IOException { InputStream inputStream=testSubject.asInputStream(); byte[] buffer = new byte[4096]; int r = inputStream.read(buffer); buffer = Arrays.copyOf(buffer, r); byte[] wrappedBytes = wrapped.toByteArray(); assertEquals( r, wrappedBytes.length); assertArrayEquals(buffer, wrappedBytes); }