### Question:
ReflectionObjectFactory implements ObjectFactory<T> { @Override public T fromString(String rawValue) { try { return targetClass().cast(this.method.invoke(null, rawValue)); } catch (Exception e) { throw new ObjectParseException(e,targetClass(),rawValue); } } ReflectionObjectFactory(Class<? extends T> valueClass, Method method); @Override Class<? extends T> targetClass(); @Override T fromString(String rawValue); @Override String toString(T value);  }### Answer:
@Test public void testFromString() throws Exception { try { this.sut.fromString("data"); fail("Should fail to create object"); } catch (ObjectParseException e) { assertThat((Object)e.getValueClass(),sameInstance((Object)ReflectionObjectFactoryTest.class)); assertThat(e.getRawValue(),equalTo("data")); assertThat(e.getCause(),instanceOf(InvocationTargetException.class)); assertThat(e.getCause().getCause(),instanceOf(IllegalStateException.class)); } }