@Test
  public void canBeReconstitutedFromByteArray() throws Exception {
    String key = impl.getStorageKey();
    HttpCacheEntry entry = impl.getHttpCacheEntry();
    byte[] bytes = impl.toByteArray();
    impl = new MemcachedCacheEntryImpl();
    impl.set(bytes);

    assertEquals(key, impl.getStorageKey());
    assertEquivalent(entry, impl.getHttpCacheEntry());
  }
 @Test(expected = MemcachedSerializationException.class)
 public void cannotReconstituteFromGarbage() {
   impl = new MemcachedCacheEntryImpl();
   byte[] bytes = HttpTestUtils.getRandomBytes(128);
   impl.set(bytes);
 }
 @Test
 public void knowsItsCacheEntry() {
   assertEquals(entry, impl.getHttpCacheEntry());
 }
 @Test
 public void knowsItsCacheKey() {
   assertEquals("foo", impl.getStorageKey());
 }
 @Test
 public void canBeSerialized() {
   byte[] bytes = impl.toByteArray();
   assertNotNull(bytes);
   assertTrue(bytes.length > 0);
 }
 @Test
 public void canBeCreatedEmpty() {
   impl = new MemcachedCacheEntryImpl();
   assertNull(impl.getStorageKey());
   assertNull(impl.getHttpCacheEntry());
 }