use of powermock.classloading.classes.MyHierarchicalFieldHolder in project powermock by powermock.
the class XStreamClassloaderExecutorTest method worksWithObjectHierarchy.
@Test
public void worksWithObjectHierarchy() throws Exception {
final MockClassLoader classloader = createClassloader();
final MyHierarchicalFieldHolder tested = new MyHierarchicalFieldHolder();
assertSame(tested.getMyArgument1(), tested.getMyArgument2());
assertEquals(tested.getMyArgument3(), tested.getMyArgument2());
new SingleClassloaderExecutor(classloader).execute(new Runnable() {
public void run() {
assertEquals(MockClassLoader.class.getName(), this.getClass().getClassLoader().getClass().getName());
assertSame(tested.getMyArgument1(), tested.getMyArgument2());
assertEquals(tested.getMyArgument3(), tested.getMyArgument2());
}
});
}
use of powermock.classloading.classes.MyHierarchicalFieldHolder in project powermock by powermock.
the class ObjenesisClassloaderExecutorTest method worksWithObjectHierarchy.
@Test
public void worksWithObjectHierarchy() throws Exception {
final MockClassLoader classloader = createClassloader();
final MyHierarchicalFieldHolder tested = new MyHierarchicalFieldHolder();
assertSame(tested.getMyArgument1(), tested.getMyArgument2());
assertEquals(tested.getMyArgument3(), tested.getMyArgument2());
new SingleClassloaderExecutor(classloader).execute(new Runnable() {
public void run() {
assertEquals(MockClassLoader.class.getName(), this.getClass().getClassLoader().getClass().getName());
assertSame(tested.getMyArgument1(), tested.getMyArgument2());
assertEquals(tested.getMyArgument3(), tested.getMyArgument2());
}
});
}
Aggregations