### Question:
LongAccessor implements PropertyAccessor<Long> { @Override public Long fromString(Class targetClass, String s) { try { if (s == null) { if (log.isWarnEnabled()) { log.warn("String s is null."); } return null; } Long l = new Long(s); return l; } catch (NumberFormatException e) { log.error("Number format exception, Caused by {}.", e); throw new PropertyAccessException(e); } }  @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 testFromString() { Assert.assertNull(accessor.fromString(Long.class, null)); Long d1 = new Long(4); String s = d1.toString(); Long d2 = accessor.fromString(Long.class, s); Assert.assertEquals(d1, d2); }