### Question:
ObjectAccessor implements PropertyAccessor<Object> { @Override public final Object fromBytes(Class targetClass, byte[] bytes) { try { if (bytes == null) { return null; } if (targetClass != null && targetClass.equals(byte[].class)) { return bytes; } ObjectInputStream ois; ois = new ObjectInputStream(new ByteArrayInputStream(bytes)); Object o = ois.readObject(); ois.close(); return o; } catch (IOException e) { log.error("IO exception, Caused by {}.", e); throw new PropertyAccessException(e); } catch (ClassNotFoundException e) { log.error("Class not found exception, Caused by {}.", e); throw new PropertyAccessException(e); } }  @Override final Object fromBytes(Class targetClass, byte[] bytes); @Override final byte[] toBytes(Object o); @Override final String toString(Object object); @Override Object fromString(Class targetClass, String s); @Override Object getCopy(Object object); Object getInstance(Class<?> clazz); static Logger log; }### Answer:
@Test public void testFromBytes() { Assert.assertNull(accessor.fromBytes(PersonalDetail.class, null)); PersonalDetail pd = new PersonalDetail("Amresh", "password", "single"); byte[] b = accessor.toBytes(pd); Object o = accessor.fromBytes(PersonalDetail.class, b); Assert.assertNotNull(o); Assert.assertTrue(o instanceof PersonalDetail); Assert.assertTrue(o.equals(pd)); }