Hi
I have two classes, DBKeyImpl which implements DBKey and extends AbstractDBImpl. AbstractDBImpl extends AbstractDB which has a method which returns the PersistenceManager.
public abstract class AbstractDBImpl extends AbstractDB {
protected PersistenceManager getPmf()
return PMF.get().getPersistenceManager();
}
DBKeyImpl extends AbstractDBImpl calls the getPmf(). I want to write a JUnit which tests DBKeyImpl.
public class DBKeyEventOldTest extends BaseTest
KeyObject keyObject = new KeyObject();
keyObject.setUserid("userId");
DBKey dbKey = new DBKeyImpl();
GAE does not support sun.reflect.Reflection, so we can't use Reflection.getCallerClass(arg0).
In order to test the DBKeyImpl and the PersistenceManager, you will use a mocked up PersistenceManager.
Is it possible for me to find the calling class (via reflection) - ie the test class for me to determine the calling class, so that I can use the mocked up PersistenceManager?
One work around for this is for me to extend my Testclass to DBKeyImpl and override the PersistenceManager. This is a hack and is tightly coupled.
Cheers
Patrick