コード例 #1
0
  @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());
  }
コード例 #2
0
  // {!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()));
  }