cookbook:ut
这是本文档旧的修订版!
验证抛出异常
ResponseStatusException exception =
assertThrows(
ResponseStatusException.class,
() -> {
controller.zipFile(request2);
});
assertEquals(exception.getStatus(), HttpStatus.BAD_REQUEST);
捕获参数
var captor = ArgumentCaptor.forClass(GetFileRequest.class);
when(jetfirePublicApi.downloadFile(captor.capture())).thenReturn(file);
File resFile = client.downloadFile(fileId);
assertEquals(captor.getValue().getId(), fileId);
cookbook/ut.1634626663.txt.gz · 最后更改: 2021/10/19 14:57 由 plough