### Question:
MValue implements ModelElement<T> { public T asEhcacheObject(ClassLoader loader) { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); T asEhcacheObject(ClassLoader loader); @Override String toString(); String getTypeName(); String getValue(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testEnumValue() throws CustomParseException { MEnum<Foo> enumVal = new MValue.MEnum<Foo>(null, Foo.class.getName(), "Bar"); Enum<Foo> obj = enumVal.asEhcacheObject(getClass().getClassLoader()); Assert.assertEquals(Foo.Bar, obj); try { MEnum<Foo> mEnum = new MValue.MEnum<Foo>(null, Foo.class.getName(), "Barr"); mEnum.asEhcacheObject(getClass().getClassLoader()); Assert.fail(); } catch (Exception e) { } }
@Test public void testNonEnumValue() throws CustomParseException { try { MEnum<Foo> mEnum = new MValue.MEnum<Foo>(null, Boolean.class.getName(), "TRUE"); mEnum.asEhcacheObject(getClass().getClassLoader()); Assert.fail(); } catch (Exception e) { } }