use of org.simpleflatmapper.reflect.ObjectSetterFactory in project SimpleFlatMapper by arnaudroger.
the class ObjectGetterFactoryTest method testExtension.
@Test
public void testExtension() throws Exception {
Foo foo = new Foo();
new ObjectSetterFactory(null).getSetter(Foo.class, "bar").set(foo, "bar");
new ObjectSetterFactory(null).getFieldSetter(Foo.class, "bar").set(foo, "bar");
assertEquals("bar", noAsm.getGetter(Foo.class, "bar").get(foo));
assertEquals("bar", noAsm.getFieldGetter(Foo.class, "bar").get(foo));
}
use of org.simpleflatmapper.reflect.ObjectSetterFactory in project SimpleFlatMapper by arnaudroger.
the class ObjectSetterFactoryTest method testFailFallBackToMethod.
@Test
public void testFailFallBackToMethod() throws Exception {
Setter<Foo, String> setter = new ObjectSetterFactory(new AsmFactory(Thread.currentThread().getContextClassLoader()) {
@Override
public <T, P> Setter<T, P> createSetter(Method m) throws Exception {
throw new UnsupportedOperationException();
}
}).getSetter(Foo.class, "foo");
assertTrue(setter instanceof MethodSetter);
SetterHelperTest.validateFooSetter(setter);
}
Aggregations