### Question:
EnumAccessor implements PropertyAccessor<Enum> { @Override public Enum fromString(Class targetClass, String string) { if (targetClass != null && string != null) { try { return Enum.valueOf(targetClass, string.trim()); } catch (IllegalArgumentException ex) { log.error("Illegal argument exception, Caused by {}.", ex); throw new PropertyAccessException(ex); } } return null; }  @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 testFromString() { try { Day day11 = (Day) accessor.fromString(Day.class, day1.name()); Assert.assertEquals(day1, day11); Day day22 = (Day) accessor.fromString(Day.class, day2.name()); Assert.assertEquals(day2, day22); Day day = (Day) accessor.fromString(Day.class, null); Assert.assertNull(day); day = (Day) accessor.fromString(null, day1.name()); Assert.assertNull(day); day = (Day) accessor.fromString(null, null); Assert.assertNull(day); } catch (PropertyAccessException e) { Assert.fail(e.getMessage()); } }