You're right!
I refactored my code and forget to annotate the new setUp method with @Before.
Sorry for taking your time! It works now.

Thanks,
Krishna


2010/2/11 Max Ross (Google) <maxr+appeng...@google.com>:
> 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 <krishnacal...@gmail.com>
> wrote:
>>
>> Ooops.. missed your question!
>> It's just:
>>        @Override
>>        protected Environment newEnvironment() {
>>                return new TestEnvironment();
>>        }
>>
>> Thanks,
>> Krishna
>>
>> 2010/2/11 Max Ross (Google) <maxr+appeng...@google.com>:
>> > 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 <krishnacal...@gmail.com>
>> > 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)" <ika...@google.com> 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 时空之蕊 <skzr....@gmail.com>
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > > 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
>> >> > > google-appengine-j...@googlegroups.com.
>> >> > > To unsubscribe from this group, send email to
>> >> > >
>> >> > >
>> >> > > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2B
>> >> > > unsubscr...@googlegroups.com>
>> >> > > .
>> >> > > 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
>> >> google-appengine-j...@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.
>> >>
>> >
>> > --
>> > 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-j...@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.
>> >
>>
>> --
>> 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-j...@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.
>>
>
> --
> 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-j...@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.
>

-- 
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-j...@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.

Reply via email to