Problem: An Entity was a final class.
Solution: Use power mock or mocking container which let's you mock the
final classes.

On Oct 28, 8:56 pm, mayumi <[email protected]> wrote:
> I'm actually not testing the Entity itself or Appengine
> DatastoreService.
> Basically, I am converting the Entity to object I need than performing
> some
> operations to all the entity that is relevant.
> What I am testing is the idempotence and making sure that object which
> is converted
> will result in same outcome event executed twice, etc so the behavior
> of what is
> happening inside the map().
>
> Testing framework we're using requires Guice to inject or create mocks
> as necessary.
> Maybe this could be the problem?
>
> Thanks for the reply.
>
> On Oct 28, 1:52 pm, "Ikai Lan (Google)" <[email protected]>
> wrote:
>
> > Do you need to mock Entity? Can you use a real instance of an Entity and
> > check for state changes? You can mock out DatastoreService, so it might make
> > more sense to write your expects() in those mocks instead. Entity classes
> > only really have getProperty() and setProperty(), and in my opinion, it's
> > not worth writing tests to see if these get called. What are you trying to
> > do?
>
> > --
> > Ikai Lan
> > Developer Programs Engineer, Google App Engine
> > Blogger:http://googleappengine.blogspot.com
> > Reddit:http://www.reddit.com/r/appengine
> > Twitter:http://twitter.com/app_engine
>
> > On Thu, Oct 28, 2010 at 9:31 AM, Mayumi Liyanage <
>
> > [email protected]> wrote:
> > > In the project I'm working on we are using GWT + GAE. We are unit
> > > testing using automocking container Jukito (http://code.google.com/p/
> > > jukito/) which is  build on top of Mokito (http://code.google.com/p/
> > > mockito/) + JUnit.
> > > The problem is unit testing the Mapper API. Since Mapper API's map
> > > method takes an Entity as a argument so testing framework will have to
> > > have access to this Entity class. However we could not mock the Entity
> > > class since it is a final class.  Also, we could not instantiate the
> > > Entity class outside of GAE environment. '
> > > Does anyone have workaround for unit testing using Entity?
>
> > > Thanks.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Google App Engine" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<google-appengine%[email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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?hl=en.

Reply via email to