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