How to mock/test method that returns void, possibly in Mockito

Viewed 78882

I came across a problem and I can't find an elegant solution.

So the problem is with a mock of Selenium web driver, and I dont know how should I test/mock void methods.

public void clickAndWait(String locator) {
    if(isElementPresent(locator) == false) throw some exception;
    selenium.clickAndWait(); //a problematic delegating call to selenium
}

So what I am asking is, how to properly test such a method, one test would be for exception being thrown, but how properly make test of that void method I delegate to?

6 Answers
Related