Your code looks fine. Are you sure you're calling setUp() on the LocalServiceTestHelper?
On Thu, Feb 11, 2010 at 10:11 AM, Krishna Caldas <[email protected]>wrote: > Ooops.. missed your question! > It's just: > @Override > protected Environment newEnvironment() { > return new TestEnvironment(); > } > > Thanks, > Krishna > > 2010/2/11 Max Ross (Google) > <[email protected]<maxr%[email protected]> > >: > > Subclassing LocalServiceTestHelper and overriding newEnvironment() should > > work fine. What does your implementation of newEnvironment() look like? > > > > On Wed, Feb 10, 2010 at 7:35 PM, Krishna <[email protected]> > wrote: > >> > >> Ok! > >> > >> But when I'm using transactions I'm getting: > >> > >> java.lang.NullPointerException: No API environment is registered for > >> this thread. > >> at > >> > >> > com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java: > >> 67) > >> at > >> > >> > com.google.appengine.api.datastore.DatastoreServiceImpl.beginTransaction(DatastoreServiceImpl.java: > >> 270) > >> > >> I've tried to extend LocalServiceTestHelper and overwrite > >> newEnvironment() with my Environment (who returns appId) but it > >> didn't work... > >> > >> What's wrong? > >> > >> Thanks, > >> Krishna > >> > >> On Feb 10, 10:25 pm, "Ikai L (Google)" <[email protected]> wrote: > >> > We've got a more simple interface for you now. Take a look: > >> > > >> > > http://code.google.com/appengine/docs/java/tools/localunittesting.html > >> > > >> > 2010/2/10 时空之蕊 <[email protected]> > >> > > >> > > >> > > >> > > >> > > >> > > I found the class > >> > > com.google.appengine.tools.development.ApiProxyLocalImpl is not > >> > > public,but before 1.3.1 it's public! > >> > > In the JUnit document: > >> > > >> > > import java.io.File; > >> > > import com.google.appengine.tools.development.ApiProxyLocalImpl; > >> > > import com.google.apphosting.api.ApiProxy; > >> > > >> > > ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){}); > >> > > >> > > So I can't new a ApiProxyLocalImpl instance! > >> > > Any body know how to use JUnit? > >> > > Thanks :) > >> > > >> > > -- > >> > > 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 > >> > > [email protected]. > >> > > To unsubscribe from this group, send email to > >> > > > >> > > [email protected]<google-appengine-java%[email protected]> > <google-appengine-java%2B > >> > > [email protected]> > >> > > . > >> > > For more options, visit this group at > >> > >http://groups.google.com/group/google-appengine-java?hl=en. > >> > > >> > -- > >> > Ikai Lan > >> > Developer Programs Engineer, Google App > >> > Enginehttp://googleappengine.blogspot.com| > http://twitter.com/app_engine > >> > >> -- > >> 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 > >> [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]<google-appengine-java%[email protected]> > . > >> For more options, visit this group at > >> http://groups.google.com/group/google-appengine-java?hl=en. > >> > > > > -- > > 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 > [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<google-appengine-java%[email protected]> > . > > For more options, visit this group at > > http://groups.google.com/group/google-appengine-java?hl=en. > > > > -- > 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 > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
