use of powermock.classloading.classes.ReflectionMethodInvoker in project powermock by powermock.
the class XStreamClassloaderExecutorTest method worksWithReflection.
@Test
public void worksWithReflection() throws Exception {
final MockClassLoader classloader = createClassloader();
final MyArgument myArgument = new MyArgument("test");
final MyReturnValue instance = new MyReturnValue(myArgument);
Method method = instance.getClass().getMethod("getMyArgument");
final ReflectionMethodInvoker tested = new ReflectionMethodInvoker(method, instance);
new SingleClassloaderExecutor(classloader).execute(new Runnable() {
public void run() {
Object invoke = tested.invoke();
assertSame(invoke, myArgument);
}
});
}
use of powermock.classloading.classes.ReflectionMethodInvoker in project powermock by powermock.
the class ObjenesisClassloaderExecutorTest method worksWithReflection.
@Test
public void worksWithReflection() throws Exception {
final MockClassLoader classloader = createClassloader();
final MyArgument myArgument = new MyArgument("test");
final MyReturnValue instance = new MyReturnValue(myArgument);
Method method = instance.getClass().getMethod("getMyArgument");
final ReflectionMethodInvoker tested = new ReflectionMethodInvoker(method, instance);
new SingleClassloaderExecutor(classloader).execute(new Runnable() {
public void run() {
Object invoke = tested.invoke();
assertSame(invoke, myArgument);
}
});
}
Aggregations