### Question:
ParseEnum implements IsParser<Enum> { @Override public Enum parse(JsonParser parser, Field field) throws IOException { Class<? extends Enum> enumClass = (Class<? extends Enum>) field.getType(); return isValid(parser) ? valueOf(enumClass, parser.getValueAsString()) : null; }  @Override Enum parse(JsonParser parser, Field field);  }### Answer:
@Test public void parse() throws Exception { TestEnum expected = TestEnum.ON; Field field = getClass().getField("testEnum"); ParseEnum parseEnum = new ParseEnum(); TestEnum actual = (TestEnum) parseEnum.parse(getParser("<enum>ON</enum>"), field); assertEquals(expected, actual); }
@Test public void parseEmpty() throws Exception { TestEnum expected = null; Field field = getClass().getField("testEnum"); ParseEnum parseEnum = new ParseEnum(); TestEnum actual = (TestEnum) parseEnum.parse(getParser("<enum></enum>"), field); assertEquals(expected, actual); }
@Test public void parseSpace() throws Exception { TestEnum expected = null; Field field = getClass().getField("testEnum"); ParseEnum parseEnum = new ParseEnum(); TestEnum actual = (TestEnum) parseEnum.parse(getParser("<enum> </enum>"), field); assertEquals(expected, actual); }