BlobHelper { public static Object deserializeBlob(byte[] blob) throws IOException, ClassNotFoundException { return deserializeBlob(blob, null, null); }  static byte[] serializeToBlob(Object obj); static byte[] serializeToBlob(Object obj, KnownVersion version); static void serializeTo(Object obj, HeapDataOutputStream hdos); static Object deserializeBlob(byte[] blob); static Object deserializeBlob(byte[] blob, KnownVersion version, ByteArrayDataInput in); static @Unretained Object deserializeOffHeapBlob(StoredObject blob); static Object deserializeBuffer(ByteArrayDataInput in, int numBytes);  }
@Test public void deserializeBlobOfClassNotFoundSerializationThrowsEOFException() throws Exception { assertThatThrownBy(() -> deserializeBlob(this.bytesOfClassNotFoundSerialization)) .isExactlyInstanceOf(ClassNotFoundException.class); }
@Test public void deserializeBlobOfMapReturnsCopyOfMap() throws Exception { final Object object = deserializeBlob(this.bytesOfMap); assertThat(object).isNotNull(); assertThat(object).isExactlyInstanceOf(HashMap.class); assertThat(object).isNotSameAs(this.mapWithTwoEntries); assertThat(object).isEqualTo(this.mapWithTwoEntries); }
@Test public void deserializeBlobOfNullReturnsNull() throws Exception { assertThat(deserializeBlob(this.bytesOfNull)).isNull(); }
@Test public void deserializeBlobOfZeroBytesThrowsEOFException() throws Exception { assertThatThrownBy(() -> deserializeBlob(this.zeroBytes)) .isExactlyInstanceOf(EOFException.class); }
@Test public void deserializeBlobWithNullThrowsNullPointerException() throws Exception { assertThatThrownBy(() -> deserializeBlob(null)).isExactlyInstanceOf(NullPointerException.class); }