You may consider taking a look at the "Local Unit Testing for Java 8" 
documentation page 
<https://cloud.google.com/appengine/docs/standard/java/tools/localunittesting>, 
where actual and quite useful JUnit examples are provided. 

On Thursday, 15 October 2020 at 18:44:51 UTC-4 maicol...@bluetab.net wrote:

> Hi, I'm here 10 years later, I'd like to coverage my real  Datastore 
> entities with mock using Junit, I don't know how to deal with that. Any 
> help ?
> Thanks in advance.
>
> On Friday, November 19, 2010 at 1:28:55 AM UTC-5 mayumi wrote:
>
>> 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 <mayumi.liyan...@gmail.com> 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)" <ikai.l+gro...@google.com> 
>> > 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 < 
>> > 
>> > > mayumi.liyan...@coldwin.com> 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 google-a...@googlegroups.com. 
>> > > > To unsubscribe from this group, send email to 
>> > > > google-appengi...@googlegroups.com<
>> google-appengine%2bunsu...@googlegroups.com> 
>> > > > . 
>> > > > 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 unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/b77abfd5-c607-4fd0-a027-e3000669f3b4n%40googlegroups.com.
  • [google-appengine]... Maicol Lastra
    • [google-appen... 'George (Cloud Platform Support)' via Google App Engine

Reply via email to