@Test public void receiveAnOrder() throws Exception { when(request.getMethod()).thenReturn("POST"); when(request.getRequestURI()).thenReturn("/orders"); when(request.getParameter("order_code")).thenReturn("1234"); when(request.getParameter("article_code")).thenReturn("ABCD"); when(request.getParameter("address")).thenReturn("Some Place"); ordersController.service(); assertEquals(1, orders.size()); assertEquals(new Order("1234", "ABCD", "Some Place"), orders.get(0)); }
@Test @Ignore public void theControllerWillShipAnOrder() throws Exception { Order order = new Order("5555", "_", "_"); orders.add(order); when(request.getMethod()).thenReturn("POST"); when(request.getRequestURI()).thenReturn("/orders/shipped"); when(request.getParameter("order_code")).thenReturn("5555"); ordersController.service(); assertEquals("controller should set shipped", true, order.isShipped()); verify(ordersView).refresh(); }