void () { myRepository.setPassword("wrong-password"); try { //noinspection ConstantConditions final Exception exception = myRepository.createCancellableConnection().call(); assertNotNull("Test connection must fail when wrong credentials are specified", exception); } catch (Exception e) { assertEquals(TaskBundle.message("failure.login"), e.getMessage()); } }