### Question:
FunctionalGetterInvoker extends MethodNamedObject implements GetterInvoker { public static FunctionalGetterInvoker create(String name, Method method) { return new FunctionalGetterInvoker(name, method); } private  FunctionalGetterInvoker(String name, Method method); static FunctionalGetterInvoker create(String name, Method method); @SuppressWarnings("unchecked") @Override Object invoke(Object obj); @Override Type getReturnType(); @Override Class<?> getReturnRawType();  }### Answer:
@Test public void testException() throws Exception { thrown.expect(ClassCastException.class); thrown.expectMessage("function[class org.jfaster.mango.invoker.FunctionalGetterInvokerTest$IntegerToStringFunction] on method[java.lang.String org.jfaster.mango.invoker.FunctionalGetterInvokerTest$E.getX()] error, function's inputType[class java.lang.Integer] must be assignable from method's returnType[class java.lang.String]"); Method method = E.class.getDeclaredMethod("getX"); E e = new E(); e.setX("9527"); FunctionalGetterInvoker.create("x", method); }
@Test public void testException2() throws Exception { thrown.expect(ClassCastException.class); thrown.expectMessage("function[class org.jfaster.mango.invoker.FunctionalGetterInvokerTest$IntegerListToStringFunction] on method[java.util.List org.jfaster.mango.invoker.FunctionalGetterInvokerTest$F.getX()] error, function's inputType[java.util.List<java.lang.Integer>] must be assignable from method's returnType[java.util.List<java.lang.String>]"); Method method = F.class.getDeclaredMethod("getX"); F e = new F(); ArrayList<String> x = Lists.newArrayList("xxx"); e.setX(x); FunctionalGetterInvoker.create("x", method); }