OrderController { @RequestMapping(value = "/orders/create", method=RequestMethod.GET) public String showCreateOrdersForm(ModelMap modelMap, @RequestParam("customerId") int customerId) { Customer customer = customerService.findCustomerByCustomerId(customerId); Order order = new Order(); order.setCustomer(customer); List<Item> items = itemService.getItems(); modelMap.addAttribute("createOrderForm", order); modelMap.addAttribute("itemsList", items); return "orders/orders-createOrder"; }  @RequestMapping(value = "/orders/create", method=RequestMethod.GET) String showCreateOrdersForm(ModelMap modelMap, @RequestParam("customerId") int customerId); @RequestMapping(value = "orders/createOrder", method = RequestMethod.POST) ModelAndView createOrder(@ModelAttribute("createOrderForm") Order order, BindingResult result); @RequestMapping(value="/orders", method=RequestMethod.GET) String listOrders(ModelMap modelMap);  }
@Test public void testShowCreateOrdersForm() { Customer customer = new Customer(); Mockito.when(customerService.findCustomerByCustomerId(Matchers.anyInt())) .thenReturn(customer); Mockito.when(itemService.getItems()).thenReturn(Collections.emptyList()); assertEquals("orders/orders-createOrder", orderController.showCreateOrdersForm(new ModelMap(), 1)); }