If you print out the contents of ModelMap, what does it have in there?
You might try debugging your test and setting a breakpoint to
inspect.
Matt
On 5/22/07, marshall <[EMAIL PROTECTED]> wrote:
Sure;
Here it is:
package com.ss.webapp.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.appfuse.service.GenericManager;
import com.socialsplendor.relisting.model.Person;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
public class PersonController implements Controller {
private final Log log = LogFactory.getLog(PersonController.class);
private GenericManager<Person, Long> personManager = null;
public void setPersonManager(GenericManager<Person, Long>
personManager) {
this.personManager = personManager;
}
public ModelAndView handleRequest(HttpServletRequest
request, HttpServletResponse response) throws Exception {
log.debug("entering 'handleRequest' method...");
return new ModelAndView().addObject(personManager.getAll());
}
}
Marshall
Matt Raible <[EMAIL PROTECTED]> wrote:
The problem likely occurs in PersonController.java - can you post the
code for that?
Thanks,
Matt
On 5/22/07, marshall wrote:
> Sure Matt;
>
> I'll include a few things just in case, starting with the
> PersonControllerTest class:
>
> package com.ss.webapp.controller;
>
> import java.util.List;
> import
> org.appfuse.webapp.controller.BaseControllerTestCase;
> import org.springframework.ui.ModelMap;
> import org.springframework.web.servlet.ModelAndView;
>
> public class PersonControllerTest extends BaseControllerTestCase {
> private PersonController c;
>
> public void setPersonController(PersonController c) {
> this.c = c;
> }
>
> public void testHandleRequest() throws Exception {
> ModelAndView mav = c.handleRequest(null, null);
> ModelMap m = mav.getModelMap();
> assertNotNull(m.get("personList"));
> assertTrue(((List) m.get("personList")).size() > 0);
> }
> }
>
> and the core/src/main/resources/applicationContext.xml
>
>
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
xsi:schemaLocation="http://www.springframework.org/schema/beans
>
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
>
> > class="org.appfuse.service.impl.GenericManagerImpl">
>
> > autowire="byType">
>
>
>
>
>
>
>
> and my dispatcher-servlet.xml configuration for personController:
>
> > class="com.ss.webapp.controller.PersonController">
>
>
>
> I hope this if enough information for you.
>
> thanks;
>
> Marshall
>
> Matt Raible wrote:
> What does the handleRequest() method of your PersonController look like?
>
> Matt
>
> On 5/22/07, marshall wrote:
> > Hey all;
> >
> > I'm pretty new to appfuse. I'm going thru the tutorial, using a modular
> > spring MVC archetype. I've created a PersonController and
> > PersonControllerTest in the respective directories in the web/
component.
> > I've also modified the dispatcher-servlet.xml for the proper mapping.
> > When I run mvn test -Dtest=PersoncontrollerTest I'm getting an
> > AssertionfailedError on the following line in PersonControllerTest:
> >
> > assertNotNull(m.get("personList"));
> >
> > Is there another configuration setting that I've overlooked?
> >
> > Thanks;
> >
> > Marshall
> >
> > ________________________________
> > Finding fabulous fares is fun.
> > Let Yahoo! FareChase search your favorite travel sites to find flight
and
> > hotel bargains.
> >
> >
>
>
> --
> http://raibledesigns.com
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> ________________________________
> Park yourself in front of a world of choices in alternative vehicles.
> Visit the Yahoo! Auto Green Center.
>
>
--
http://raibledesigns.com
---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Shape Yahoo! in your own image. Join our Network Research Panel today!
http://us.rd.yahoo.com/evt=48517/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
hot CTA = Join our Network Research Panel
--
http://raibledesigns.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]