Merge pull request #7321 from alvasw/Add_send_more_BSQ_than_in_wallet_test

Add send more BSQ than in wallet test
This commit is contained in:
Alejandro García 2024-12-10 07:55:56 +00:00 committed by GitHub
commit 6e7f80b2bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -155,4 +155,24 @@ public class BitcoinjBsqTests {
assertThrows(InsufficientMoneyException.class, () ->
bsqWalletV2.sendBsq(receiverAddress, receiverAmount, Coin.ofSat(10)));
}
@Test
void sendMoreBsqThanInWalletTest() {
var bsqWalletV2 = new BsqWalletV2(networkParams,
peerGroup,
btcWalletV2,
bsqWallet,
bsqCoinSelector);
var secondBsqWalletReceivedLatch = new CountDownLatch(1);
secondBsqWallet.addCoinsReceivedEventListener((wallet, tx, prevBalance, newBalance) ->
secondBsqWalletReceivedLatch.countDown());
Address receiverAddress = secondBsqWallet.currentReceiveAddress();
Coin receiverAmount = bsqWallet.getBalance()
.add(Coin.valueOf(100));
assertThrows(InsufficientMoneyException.class, () ->
bsqWalletV2.sendBsq(receiverAddress, receiverAmount, Coin.ofSat(10)));
}
}