I have the same problem I want to test dao class using JUNIT.
How I can do it?

thanks for any help!

On Wed, Jan 19, 2011 at 10:34 PM, <[email protected]> wrote:

> Hi,all:
> i write a DAO in application, and i do a local junit test ,it seems ok.
>
> public List<DesignElement> findByType(String type,PageModel pageModel)
>     {
>         PersistenceManager pm = PMF.get().getPersistenceManager();
>         Query q=pm.newQuery(DesignElement.class);
>         q.setFilter("type == typeparam");
>         q.declareParameters("String typeparam");
>         q.setRange(pageModel.getStartPos()-1, pageModel.getEndPos());
>         return (List<DesignElement>)q.execute(type);
>     }
>
>  but when i test it in local dev server,an empty List is return.However, i
> check the page in the http://localhost:8080/_ah/admin,i can find some
> DesignElement pojo on the list,if i just find all by this code:
>
> public List<DesignElement> getAll()
>     {
>         PersistenceManager pm = PMF.get().getPersistenceManager();
>         Query q=pm.newQuery(DesignElement.class);
>         q.setRange(0,20);
>         return (List<DesignElement>) q.execute();
>     }
>
> all the pojo can be returned.
> so ,what's the problem?
> by the way,i have a datastore-indexs.xml in the WEB-INF/ with
> autoGenerate="true".
> thanks for any help!!
>
> --
> 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.

Reply via email to