Closed Rezar00 closed 11 months ago
@toedter
thx for reporting this, I will take a look at it soon.
I thing your test case is incorrect, 'included' is never at the same json path level as 'id', it is always on the level of 'data'. Did you manually check the actual response?
I tried "$.data" but there is no JSON PATH.
Hi, I was faced with an issue. Below is my endpoint:
And Below is my test case:
var orderStatusResponse = dummyOrderResponseWithStatus(OrderStatus.COMPLETED); when(orderService.getOrder(ORDER_ID, ACTOR)).thenReturn(orderStatusResponse); when(orderService.getDocumentByOrderId(ORDER_ID)).thenReturn(List.of(dummyDocumentServiceResponse())); ResultActions accept = mockMvc.perform(MockMvcRequestBuilders.get("/orders/{id}", ORDER_ID) .accept(JSON_API) .header(CUSTOMER_ID_HEADER, ACTOR)); accept .andExpect(status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.id").value(orderStatusResponse.getId())) .andExpect(MockMvcResultMatchers.jsonPath("$.included").value(OrderStatus.COMPLETED.toString()));
I cannot read $.included. It is not present in json path