How to mock void method using mockito

sometimes, we need to mock void method like this:

public void printLine() {
  //... ...
}

 
how to mock it by using mockito ?
here it is:

Mockito.doNothing().when(handler).printLine();

 

猜你喜欢

转载自sunxboy.iteye.com/blog/2005614
今日推荐