【发布时间】:2021-08-16 08:02:33
【问题描述】:
我正在使用 mockMvc 进行测试。如何在 mockMVc.perform 中发送 PaymentOrderDto 对象值,我可以在控制器方法中接收。
如 PaymentOrderDto.setMid("m1") 等
@PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces= MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> createPaymentOrder(HttpServletRequest request, PaymentOrderDto paymentOrderDto,
@RequestPart(required = false) MultipartFile paymentReceiptFile,
@RequestParam(value = "contactId", required = true) String contactId,
HttpServletResponse response) {
--method body
}
List item
【问题讨论】:
标签: java unit-testing mockito mockmvc springmockito