I am quite confused when I read the instructions about unit testings on the official site. It mentions that we need to have LocalServiceTestHelper set up to do the unit testings. Currently, I have a huge system which consists of 6 different JDO persistent data classes; and in testings I would definitely need to create some of these data objects and operate on them. But the DatastoreService thing stated in the instruction page, can only put in Entity object.
sth like this: DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); Entity coordinator = new Entity("Coordinator"); coordinator.setProperty("googleAccount", "lailailai"); coordinator.setProperty("name", "Ms Lai"); ds.put(coordinator); coordinatorKey = coordinator.getKey(); However, what I really want to have is an object of the following data class: @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Coordinator { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private String googleAccount; @Persistent private String name; @Persistent private List<Key> courses; public Coordinator(String googleAccount, String name) { super(); this.googleAccount = googleAccount; this.name = name; this.courses = new ArrayList<Key>(); } public void addCourse(Key c){ courses.add(c); } /*getters and setters */ } I have been searching for a few hours, on the way how to convert between the Entity thing and a normal JDO object. Because I really don't think this Entity object, which I can only use the setProperty() method to set its values, and have no ways to define its methods (you can see that I not only have getters and setters, but also other methods like addCourse), can let me do the unit testing in the way that can really test my existing system. I tried to use PersistenceManager as well, because I used it in my normal codes. But it fails with an error called "java.lang.NullPointerException: No API environment is registered for this thread". Please help me on this. Thanks very much! -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.