Bypesisymexb
New Member
I'm trying to do something within the GAE runtime that needs to do "mocking":\[code\] private Mongo createMongo() { Mongo mongo = Mockito.mock(Mongo.class); ... }\[/code\]However, this obviously cause an error since "reflection" is a restricted class:\[code\]java.lang.NoClassDefFoundError: sun.reflect.ReflectionFactory is a restricted class. Please see the Google App Engine developer's guide for more details. at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51) at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.<init>(SunReflectionFactoryInstantiator.java:24) at org.objenesis.strategy.StdInstantiatorStrategy.newInstantiatorOf(StdInstantiatorStrategy.java:65) at org.objenesis.ObjenesisBase.getInstantiatorOf(ObjenesisBase.java:76) at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:59) at org.mockito.internal.creation.jmock.ClassImposterizer.createProxy(ClassImposterizer.java:111) at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:51) at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:52) at org.mockito.internal.MockitoCore.mock(MockitoCore.java:41) at org.mockito.Mockito.mock(Mockito.java:1014) at org.mockito.Mockito.mock(Mockito.java:909)\[/code\]
- Is there any workaround for this? Is there a way to make "reflection"work with GAE runtime?
- Are there any "emulation" library for \[code\]sun.reflect\[/code\] that makes it possible to do reflection?
- Perhaps, to define which classes possible to be reflected? Like \[code\]@Reflectable\[/code\] or something
- Or there already exist a Mock framework that works in AppEngine?