I'm working with JUnit and Mockito to make some unitary tests. I want to handle the excepcion by using the Mockito.doThrow() and I've already made use of it in another tests and it worked the finest way possible. Now I have:
Assigned newAssigned = new Assigned();
Mockito.doThrow(new SdkFault()).when(Api).addLicenseAssigned("2144", newAssigned );
and when I run the test while making debugging of it when I find this
Api.addLicenseAssinged(licenseId, newAssigned);
It should get the excepcion and throw it me right? Or am I making something wrong? And I'm not mocking static methods.