The purpose of jmock is not clear to me. What i have undustood so far is that it is said that it is used for mocking the objects that do not actually exist!!! Is this undustanding correct?
Consider this following scenaio.
We have to implement the functionality of login page. We so far don't have any database implementation, nor have any dao class for it.
Say the controller name is LoginController, when the user logins the controller checks whether the user already exist in the database of not with the help of databaseDao class
protected ModelAndView onSubmit(Object arg0) throws Exception {
...
String usr = databaseDao.getUserId(userName);
if (usr!=null && usr.length() > 0 ){
view="home";
}
else{
view="registration";
}
return new ModelAndView(view,"user",usr);
}
With the help of jmock can i create an dummy object of databaseDao and run the application? Or it is used just to
test onSubmit method?
Can anyone please refer a tutorial for jmock to me?