### Question:
LongAccessor implements PropertyAccessor<Long> { @Override public final byte[] toBytes(Object object) { if (object != null) { Long l = (Long) object; ByteBuffer buffer = ByteBuffer.allocate(8); buffer.putLong(l); return buffer.array(); } if (log.isWarnEnabled()) { log.warn("Object is null."); } return null; }  @Override final Long fromBytes(Class targetClass, byte[] bytes); @Override final byte[] toBytes(Object object); @Override final String toString(Object object); @Override Long fromString(Class targetClass, String s); @Override Long getCopy(Object object); Long getInstance(Class<?> clazz);  }### Answer:
@Test public void testToBytes() { Assert.assertNull(accessor.toBytes(null)); Long d1 = new Long(4); byte[] b = accessor.toBytes(d1); Long d2 = accessor.fromBytes(Long.class, b); Assert.assertEquals(d1, d2); }