Package org.landal.mvcsample

Source Code of org.landal.mvcsample.InventoryControllerTest

package org.landal.mvcsample;

import java.util.Map;

import org.landal.mvcsample.service.impl.SimpleProductManager;
import org.landal.mvcsample.web.controller.InventoryController;
import org.springframework.web.servlet.ModelAndView;

import junit.framework.TestCase;

public class InventoryControllerTest extends TestCase {

  public void testHandleRequestView() throws Exception {
    InventoryController controller = new InventoryController();
    controller.setProductManager(new SimpleProductManager());
    ModelAndView modelAndView = controller.handleRequest(null, null);
    assertEquals("hello", modelAndView.getViewName());
    assertNotNull(modelAndView.getModel());
    Map modelMap = (Map) modelAndView.getModel().get("model");
    String nowValue = (String) modelMap.get("now");
    assertNotNull(nowValue);
  }

}
TOP

Related Classes of org.landal.mvcsample.InventoryControllerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.