From 057ab9e900869eac7d055487bc79327853f113dd Mon Sep 17 00:00:00 2001 From: Julian Len Date: Thu, 12 Dec 2024 10:45:47 -0300 Subject: [PATCH] fix: deleted the try/catch declarations and added the throws Exception keywords --- .../co/rsk/peg/RegisterBtcTransactionIT.java | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/rskj-core/src/test/java/co/rsk/peg/RegisterBtcTransactionIT.java b/rskj-core/src/test/java/co/rsk/peg/RegisterBtcTransactionIT.java index f3b7ae6b48..c137ee4050 100644 --- a/rskj-core/src/test/java/co/rsk/peg/RegisterBtcTransactionIT.java +++ b/rskj-core/src/test/java/co/rsk/peg/RegisterBtcTransactionIT.java @@ -37,7 +37,7 @@ public class RegisterBtcTransactionIT { private final BridgeSupportBuilder bridgeSupportBuilder = BridgeSupportBuilder.builder(); @Test - void whenRegisterALegacyBtcTransaction_shouldRegisterTheNewUtxoAndTransferTheRbtcBalance() { + void whenRegisterALegacyBtcTransaction_shouldRegisterTheNewUtxoAndTransferTheRbtcBalance() throws Exception { // Arrange ActivationConfig.ForBlock activationConfig = ActivationConfigsForTest.all().forBlock(0); Repository repository = BridgeSupportTestUtil.createRepository(); @@ -66,11 +66,7 @@ void whenRegisterALegacyBtcTransaction_shouldRegisterTheNewUtxoAndTransferTheRbt int btcBlockWithPmtHeight = bridgeConstants.getBtcHeightWhenPegoutTxIndexActivates() + bridgeConstants.getPegoutTxIndexGracePeriodInBtcBlocks(); int chainHeight = btcBlockWithPmtHeight + bridgeConstants.getBtc2RskMinimumAcceptableConfirmations(); - try { - recreateChainFromPmt(btcBlockStoreWithCache, chainHeight, pmtWithTransactions, btcBlockWithPmtHeight, bridgeConstants.getBtcParams()); - } catch (BlockStoreException e) { - fail(e.getMessage()); - } + recreateChainFromPmt(btcBlockStoreWithCache, chainHeight, pmtWithTransactions, btcBlockWithPmtHeight, bridgeConstants.getBtcParams()); bridgeStorageProvider.save(); @@ -84,25 +80,17 @@ void whenRegisterALegacyBtcTransaction_shouldRegisterTheNewUtxoAndTransferTheRbt co.rsk.core.Coin expectedReceiverBalance = receiverBalance.add(co.rsk.core.Coin.fromBitcoin(btcTransferred)); // Act - try { - bridgeSupport.registerBtcTransaction(rskTx, bitcoinTransaction.bitcoinSerialize(), btcBlockWithPmtHeight, pmtWithTransactions.bitcoinSerialize()); - } catch (Exception e) { - fail(e.getMessage()); - } + bridgeSupport.registerBtcTransaction(rskTx, bitcoinTransaction.bitcoinSerialize(), btcBlockWithPmtHeight, pmtWithTransactions.bitcoinSerialize()); bridgeSupport.save(); track.commit(); // Assert - try { - Optional heightIfBtcTxHashIsAlreadyProcessed = bridgeStorageProvider.getHeightIfBtcTxhashIsAlreadyProcessed(bitcoinTransaction.getHash()); - assertTrue(heightIfBtcTxHashIsAlreadyProcessed.isPresent()); - assertEquals(rskExecutionBlock.getNumber(), heightIfBtcTxHashIsAlreadyProcessed.get()); - } catch (IOException e) { - fail(e.getMessage()); - } + Optional heightIfBtcTxHashIsAlreadyProcessed = bridgeStorageProvider.getHeightIfBtcTxhashIsAlreadyProcessed(bitcoinTransaction.getHash()); + assertTrue(heightIfBtcTxHashIsAlreadyProcessed.isPresent()); + assertEquals(rskExecutionBlock.getNumber(), heightIfBtcTxHashIsAlreadyProcessed.get()); assertEquals(expectedFederationUtxos, federationSupport.getActiveFederationBtcUTXOs()); assertEquals(expectedReceiverBalance, repository.getBalance(receiver));