I'm trying to mock this method:
boolean login() throws SftpModuleException;
Mocking code is:
Mockito
.when(this.sftpService.login())
.thenReturn(true);
Since, login()
throws an SftpModuleException
, compiler tells me that this exception has to be handled.
Is there any work around due to this exception will never be thrown?