### Question:
EnumAccessor implements PropertyAccessor<Enum> { @Override public Enum fromBytes(Class targetClass, byte[] b) { String s = null; try { if (b == null) { return null; } s = new String(b, Constants.ENCODING); } catch (UnsupportedEncodingException e) { log.error("Unsupported encoding exception, Caused by {}.", e); throw new PropertyAccessException(e); } return fromString(targetClass, s); }  @Override Enum fromBytes(Class targetClass, byte[] b); @Override byte[] toBytes(Object object); @Override String toString(Object object); @Override Enum fromString(Class targetClass, String string); @Override Enum getCopy(Object object); Enum getInstance(Class<?> clazz);  }### Answer:
@Test public void testFromBytes() { try { byte[] b = day1.name().getBytes(Constants.ENCODING); Day dd = (Day) accessor.fromBytes(Day.class, b); Assert.assertEquals(day1, dd); Object o = accessor.fromBytes(Day.class, null); Assert.assertNull(o); } catch (UnsupportedEncodingException e) { Assert.fail(e.getMessage()); } catch (PropertyAccessException e) { Assert.fail(e.getMessage()); } }