having return in void method java code example

Example 1: java doreturn void

doNothing().when(yourMock).yourMockedMethod();

Example 2: difference between void and return method in java

Difference between void and return method
Void Method:
The "void" return type means that this
method doesn't have a return type.
It is mostly used for printing result 
to console
 
Return Method:
This other method on the other hand,
returns a String. This means that you can
use the returned value in your code for
further processing.I guess good examples
of such methods are "getters".

Tags:

Java Example