有人可以帮助做什么来解决以下提到的异常时,存根下面提到的行
Mockito.doNothing().when(customerRepository.save(customerProduct))
建议我在这里正确执行
E.g. thenReturn() may be missing.
正确的短截线示例:
when(mock.isOk()).thenReturn(true);
when(mock.isOk()).thenThrow(exception);
doThrow(exception).when(mock).someVoidMethod();
提示:
1. missing thenReturn()
2. you are trying to stub a final method, which is not supported
3. you are stubbing the behaviour of another mock inside before 'thenReturn' instruction is completed
1条答案
按热度按时间sq1bmfud1#
Mockito医生说
doNothing()
方法的用法如下:因此,在您的情况下,您可能需要尝试以下方法: