### Question:
CharAccessor implements PropertyAccessor<Character> { @Override public byte[] toBytes(Object object) { if (object == null) { return null; } Character data = null; if (object.getClass().isAssignableFrom(String.class)) { data = ((String) object).charAt(0); } else { data = (Character) object; } return new byte[] { (byte) ((data >> 8) & 0xff), (byte) ((data >> 0) & 0xff), }; }  @Override Character fromBytes(Class targetClass, byte[] data); @Override byte[] toBytes(Object object); @Override String toString(Object object); @Override Character fromString(Class targetClass, String s); @Override Character getCopy(Object object); Character getInstance(Class<?> clazz);  }### Answer:
@Test public void testToBytes() { Assert.assertNull(accessor.toBytes(null)); Character d1 = new Character('c'); byte[] b = accessor.toBytes(d1); Character d2 = accessor.fromBytes(Character.class, b); Assert.assertEquals(d1, d2); }