use of powermock.classloading.classes.MyHierarchicalOverloadedFieldHolder in project powermock by powermock.
the class ObjenesisClassloaderExecutorTest method worksWithObjectHierarchyAndOverloadedFields.
@Test
@Ignore("It seems like this test works on certain JVM's and fails on others. WHY!??!")
public void worksWithObjectHierarchyAndOverloadedFields() throws Exception {
final MockClassLoader classloader = createClassloader();
final MyHierarchicalOverloadedFieldHolder tested = new MyHierarchicalOverloadedFieldHolder();
assertSame(tested.getMyArgument1(), tested.getMyArgument2());
assertEquals(tested.getMyArgument1(), tested.getMyArgument3());
assertSame(tested.getMyArgument3(), MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
assertNotSame(MyReferenceFieldHolder.MY_ARGUMENT, MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
assertEquals(MyReferenceFieldHolder.MY_ARGUMENT, MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
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.getMyArgument1(), tested.getMyArgument3());
assertSame(tested.getMyArgument3(), MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
assertNotSame(MyReferenceFieldHolder.MY_ARGUMENT, MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
assertEquals(MyReferenceFieldHolder.MY_ARGUMENT, MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
}
});
}
use of powermock.classloading.classes.MyHierarchicalOverloadedFieldHolder in project powermock by powermock.
the class XStreamClassloaderExecutorTest method worksWithObjectHierarchyAndOverloadedFields.
@Test
public void worksWithObjectHierarchyAndOverloadedFields() throws Exception {
final MockClassLoader classloader = createClassloader();
final MyHierarchicalOverloadedFieldHolder tested = new MyHierarchicalOverloadedFieldHolder();
assertSame(tested.getMyArgument1(), tested.getMyArgument2());
assertEquals(tested.getMyArgument1(), tested.getMyArgument3());
assertSame(tested.getMyArgument3(), MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
assertNotSame(MyReferenceFieldHolder.MY_ARGUMENT, MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
assertEquals(MyReferenceFieldHolder.MY_ARGUMENT, MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
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.getMyArgument1(), tested.getMyArgument3());
// Note: Cannot be same using X-Stream
assertEquals(tested.getMyArgument3(), MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
assertNotSame(MyReferenceFieldHolder.MY_ARGUMENT, MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
assertEquals(MyReferenceFieldHolder.MY_ARGUMENT, MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
}
});
}
Aggregations