Wednesday, March 21, 2012

JUnit Mockitto - Void Method Testing

To test the void method using Junit and Mockitto use below approach
Concider someMethod s a void method inside  SomeClass

Use the below approach:

SomeClass classObjMock = (Mock)SomeClas;
doNothing().doThrow(new RuntimeException()).when(classObjMock).someMethod ();

No comments:

Post a Comment