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 ();
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