use of org.apache.ibatis.reflection.factory.DefaultObjectFactory in project mybatis-3 by mybatis.
the class JavassistProxyTest method shouldSerizalizeADeserlizaliedProxy.
@Test
void shouldSerizalizeADeserlizaliedProxy() throws Exception {
Object proxy = ((JavassistProxyFactory) proxyFactory).createDeserializationProxy(author, new HashMap<>(), new DefaultObjectFactory(), new ArrayList<>(), new ArrayList<>());
Author author2 = (Author) deserialize(serialize((Serializable) proxy));
assertEquals(author, author2);
assertNotEquals(author.getClass(), author2.getClass());
}
use of org.apache.ibatis.reflection.factory.DefaultObjectFactory in project mybatis-3 by mybatis.
the class CglibProxyTest method shouldSerizalizeADeserlizaliedProxy.
@Test
void shouldSerizalizeADeserlizaliedProxy() throws Exception {
Object proxy = ((CglibProxyFactory) proxyFactory).createDeserializationProxy(author, new HashMap<>(), new DefaultObjectFactory(), new ArrayList<>(), new ArrayList<>());
Author author2 = (Author) deserialize(serialize((Serializable) proxy));
assertEquals(author, author2);
assertNotEquals(author.getClass(), author2.getClass());
}
use of org.apache.ibatis.reflection.factory.DefaultObjectFactory in project mybatis-3 by mybatis.
the class SerializableProxyTest method shouldSerializeAProxyForABeanWithDefaultConstructor.
@Test
void shouldSerializeAProxyForABeanWithDefaultConstructor() throws Exception {
Object proxy = proxyFactory.createProxy(author, new ResultLoaderMap(), new Configuration(), new DefaultObjectFactory(), new ArrayList<>(), new ArrayList<>());
Object proxy2 = deserialize(serialize((Serializable) proxy));
assertEquals(author, proxy2);
}
use of org.apache.ibatis.reflection.factory.DefaultObjectFactory in project mybatis-3 by mybatis.
the class SerializableProxyTest method shouldKeepGenericTypes.
@Test
void shouldKeepGenericTypes() {
for (int i = 0; i < 10000; i++) {
Author pc = new Author();
Author proxy = (Author) proxyFactory.createProxy(pc, new ResultLoaderMap(), new Configuration(), new DefaultObjectFactory(), new ArrayList<>(), new ArrayList<>());
proxy.getBio();
}
}
use of org.apache.ibatis.reflection.factory.DefaultObjectFactory in project mybatis-3 by mybatis.
the class SerializableProxyTest method shouldNotCreateAProxyForAFullyLoadedBean.
@Test
void shouldNotCreateAProxyForAFullyLoadedBean() throws Exception {
Object proxy = proxyFactory.createProxy(author, new ResultLoaderMap(), new Configuration(), new DefaultObjectFactory(), new ArrayList<>(), new ArrayList<>());
Author author2 = (Author) deserialize(serialize((Serializable) proxy));
assertEquals(author.getClass(), author2.getClass());
}
Aggregations