Given the following method:
public void method(Long a, Long b, Set<Long> out) {
out.add(42L);
}
I would like to mock the out parameter that is modified upon running:
Set<Long> x = new HashSet<>();
x.add(1L);
Mockito.doNothing().when(service).method(anyLong(), anyLong(), any());
// How to mock the last parameter with x?
Question:
How can achieve that upon serivce run, the Set<Long> out parameter is mocked with a predefined value?