'How to unit test void methods whos result is calling a webclient?
Assuming I've something like this:
public void sendNotification(String uuid) {
List<MyData> dataList = myDataRepository.findAllById(uuid);
NotificationDto dto = new NotificationDto();
for (MyData data : dataList) {
// transform and append to dto
}
webclient.send(dto);
}
How can I unit test that given myDataRepository returns a list of xyz the right content is sent? Is the only way to extract the dto creation in a public method just for unit test purposes?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
