@Test
public void testDeserialize() {

  EncryptingSerializerDeserializer serializer = new EncryptingSerializerDeserializer();
  SessionManager sessionManager = mock(SessionManager.class);
  SessionConfiguration configuration = new SessionConfiguration();
  configuration.setUsingEncryption(true);
  configuration.setEncryptionKey("test");
  when(sessionManager.getMetrics()).thenReturn(new MetricRegistry());
  when(sessionManager.getConfiguration()).thenReturn(configuration);
  serializer.setSessionManager(sessionManager);
  EncryptingSerializerDeserializer tempSerializer = new EncryptingSerializerDeserializer();
  SessionManager sm = mock(SessionManager.class);
  when(sm.getMetrics()).thenReturn(new MetricRegistry());
  when(sm.getConfiguration()).thenReturn(configuration);
  tempSerializer.setSessionManager(sm);
  Date now = new Date();
  byte[] serializedString = serializer.serialize("String");
  byte[] serializedDate = serializer.serialize(now);
  byte[] serializedNull = serializer.serialize(null);
  assertEquals(null, serializer.deserialize(serializedNull));
  assertEquals("String", serializer.deserialize(serializedString));
  assertEquals(now, serializer.deserialize(serializedDate));
}