@Test public void thatViewOrderUsesHttpOK() throws Exception { when(orderService.requestOrderDetails(any(RequestOrderDetailsEvent.class))) .thenReturn(orderDetailsEvent(key)); this.mockMvc .perform(get("/aggregators/orders/{id}", key.toString()).accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()); }
// {!begin thatViewOrderRendersCorrectly} @Test public void thatViewOrderRendersCorrectly() throws Exception { when(orderService.requestOrderDetails(any(RequestOrderDetailsEvent.class))) .thenReturn(orderDetailsEvent(key)); this.mockMvc .perform(get("/aggregators/orders/{id}", key.toString()).accept(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.items['" + YUMMY_ITEM + "']").value(12)) .andExpect(jsonPath("$.key").value(key.toString())); }