### Question:
ObjectAccessor implements PropertyAccessor<Object> { @Override public final byte[] toBytes(Object o) { try { if (o != null) { if (o instanceof byte[]) { return (byte[]) o; } ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(o); oos.close(); return baos.toByteArray(); } } catch (IOException e) { log.error("IO exception, Caused by {}.", e); throw new PropertyAccessException(e); } return null; }  @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 testToBytes() { Assert.assertNull(accessor.toBytes(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(pd.equals(o)); }