### Question:
LazyModel implements IModel<T>, IObjectClassAwareModel<T>,
		IObjectTypeAwareModel<T>, IPropertyReflectionAwareModel<T> { public static <T> T from(T target) { if (target == null) { throw new WicketRuntimeException("target must not be null"); } Evaluation<T> evaluation = new BoundEvaluation<T>(target.getClass(), target); return (T) evaluation.proxy(); } LazyModel(Object target, Object stack); IModel<T> loadableDetachable(); @Override Class<T> getObjectClass(); Type getObjectType(); @Override Field getPropertyField(); @Override Method getPropertyGetter(); @Override Method getPropertySetter(); @Override void detach(); T getObject(); void setObject(T result); Object getTarget(); LazyModel<T> bind(Object target); @Override String toString(); String getPath(); static T from(T target); static T from(Class<T> targetType); static T from(IModel<T> target, Class<T> type); static T from(IModel<T> target); static LazyModel<R> model(R result); static String path(R result); static IMethodResolver methodResolver; }### Answer:
@Test public void nullFails() { try { from((A) null); fail(); } catch (Exception ex) { } }
@Test public void getStringFromFinalFails() { final A a = new A(); a.f = new F(); a.f.string = "string"; try { from(a).getF().getString(); fail(); } catch (NullPointerException expected) { } }
@Test public void fromTypeErasedModelFails() { class GenericModel<T> implements IModel<T> { @Override public void detach() { } @Override public T getObject() { return null; } @Override public void setObject(T arg0) { } }; try { from(new GenericModel<A>()); fail(); } catch (WicketRuntimeException ex) { assertEquals("cannot detect target type", ex.getMessage()); } }