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