How to mock void methods with mockito - there are two options: doAnswer - If we want our mocked void method to do something (mock the behavior despite being void). doThrow - Then there is Mockito.doThrow() if you want to throw an exception from the mocked void method. Following is an example of how to use it (not an ideal usecase but just ... More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.