From 57d0eef4540d1f71e01d753badb35606c7005678 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Sun, 31 Mar 2019 13:43:06 +0200 Subject: [PATCH] WalletTest: Be more specific about the expected exception in basicSpendingCommon() when supplying a wrong password. --- core/src/test/java/org/bitcoinj/wallet/WalletTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/org/bitcoinj/wallet/WalletTest.java b/core/src/test/java/org/bitcoinj/wallet/WalletTest.java index 7003fc77..529c687c 100644 --- a/core/src/test/java/org/bitcoinj/wallet/WalletTest.java +++ b/core/src/test/java/org/bitcoinj/wallet/WalletTest.java @@ -367,8 +367,10 @@ public class WalletTest extends TestWithWallet { try { wallet.completeTx(req); fail("No exception was thrown trying to sign an encrypted key with the wrong password supplied."); - } catch (KeyCrypterException kce) { - assertEquals("Could not decrypt bytes", kce.getMessage()); + } catch (KeyCrypterException.InvalidCipherText e) { + // Expected, either this... + } catch (KeyCrypterException.PublicPrivateMismatch e) { + // ...or this. } assertEquals("Wrong number of UNSPENT", 1, wallet.getPoolSize(WalletTransaction.Pool.UNSPENT));