@Test public void cannotReturnWalletAccountInClosedWallet() { // Arrange: final WalletAccount account = new WalletAccount(); final TestContext context = new TestContext(); context.originalWallet.addOtherAccount(account); // Act: context.walletServices.open(context.pair); context.walletServices.close(context.pair.getName()); final WalletAccount resultAccount = context.walletServices.tryFindOpenAccount(account.getAddress()); // Assert: Assert.assertThat(resultAccount, IsNull.nullValue()); }
@Test public void renamedWalletIsNotAccessibleByOldName() { // Arrange: final WalletNamePasswordPair pair2 = createPair("n2", "p"); final WalletDescriptor descriptor2 = createDescriptor("n2"); final TestContext context = new TestContext(); Mockito.when(context.descriptorFactory.createNew(pair2, FILE_EXTENSION)) .thenReturn(descriptor2); // Act: context.walletServices.open(context.pair); context.walletServices.move(context.pair, pair2); // Assert: Assert.assertThat(context.walletServices.get(new WalletName("n2")), IsNull.notNullValue()); ExceptionAssert.assertThrowsNccException( v -> context.walletServices.get(new WalletName("n")), NccException.Code.WALLET_IS_NOT_OPEN); }