@Test public void openFailsIfCachedWalletPasswordIsIncorrect() { // Arrange: final TestContext context = new TestContext(); context.walletServices.open(context.pair); // cache the wallet Mockito.when(context.repository.load(context.descriptor)) .thenThrow( new WalletStorageException(WalletStorageException.Code.WALLET_PASSWORD_INCORRECT)); // Act: ExceptionAssert.assertThrowsWalletStorageException( v -> context.walletServices.open(context.pair), WalletStorageException.Code.WALLET_PASSWORD_INCORRECT); }