@Test
    void testInvalidCacheEntry() throws Exception {
        // This file is a JPEG not a cache entry, so should fail to deserialize
        final HeapResource resource = load(getClass().getResource("/ApacheLogo.png"));
        Assertions.assertThrows(ResourceIOException.class, () ->
                httpCacheEntrySerializer.deserialize(resource.get()));
    }
Deserialize a cache entry in a bad format, expecting an exception.
httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestHttpByteArrayCacheEntrySerializer.java