use of powermock.classloading.classes.MyStaticFinalArgumentHolder in project powermock by powermock.
the class ObjenesisClassloaderExecutorTest method clonesStaticFinalObjectFields.
@Test
public void clonesStaticFinalObjectFields() throws Exception {
MockClassLoader classloader = createClassloader();
final MyStaticFinalArgumentHolder expected = new MyStaticFinalArgumentHolder();
MyStaticFinalArgumentHolder actual = new SingleClassloaderExecutor(classloader).execute(new Callable<MyStaticFinalArgumentHolder>() {
public MyStaticFinalArgumentHolder call() throws Exception {
assertEquals(MockClassLoader.class.getName(), this.getClass().getClassLoader().getClass().getName());
MyStaticFinalArgumentHolder actual = new MyStaticFinalArgumentHolder();
assertEquals(expected.getMyObject(), actual.getMyObject());
return actual;
}
});
assertFalse(MockClassLoader.class.getName().equals(this.getClass().getClassLoader().getClass().getName()));
assertEquals(expected.getMyObject(), actual.getMyObject());
}
use of powermock.classloading.classes.MyStaticFinalArgumentHolder in project powermock by powermock.
the class XStreamClassloaderExecutorTest method clonesStaticFinalObjectFields.
@Test
public void clonesStaticFinalObjectFields() throws Exception {
MockClassLoader classloader = createClassloader();
final MyStaticFinalArgumentHolder expected = new MyStaticFinalArgumentHolder();
MyStaticFinalArgumentHolder actual = new SingleClassloaderExecutor(classloader).execute(new Callable<MyStaticFinalArgumentHolder>() {
public MyStaticFinalArgumentHolder call() throws Exception {
assertEquals(MockClassLoader.class.getName(), this.getClass().getClassLoader().getClass().getName());
MyStaticFinalArgumentHolder actual = new MyStaticFinalArgumentHolder();
assertEquals(expected.getMyObject(), actual.getMyObject());
return actual;
}
});
assertFalse(MockClassLoader.class.getName().equals(this.getClass().getClassLoader().getClass().getName()));
assertEquals(expected.getMyObject(), actual.getMyObject());
}
Aggregations