Skip to content

Commit

Permalink
feat(watcher): update unit tests to accomdate BitcoinWrapper listener…
Browse files Browse the repository at this point in the history
… logic to register svp spend tx
  • Loading branch information
apancorb authored and marcos-iov committed Jan 15, 2025
1 parent 7c64b8d commit 1fa8546
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import co.rsk.bitcoinj.core.BtcECKey;
import co.rsk.bitcoinj.core.NetworkParameters;
import co.rsk.federate.BtcToRskClient;
import co.rsk.federate.bitcoin.BitcoinWrapper;
import co.rsk.federate.btcreleaseclient.BtcReleaseClient;
import co.rsk.peg.federation.Federation;
import co.rsk.peg.federation.FederationArgs;
Expand Down Expand Up @@ -38,15 +39,17 @@ class FederationWatcherListenerImplTest {
private BtcToRskClient btcToRskClientActive;
private BtcToRskClient btcToRskClientRetiring;
private BtcReleaseClient btcReleaseClient;
private BitcoinWrapper bitcoinWrapper;
private FederationWatcherListener federationWatcherListener;

@BeforeEach
void setUp() {
btcToRskClientActive = mock(BtcToRskClient.class);
btcToRskClientRetiring = mock(BtcToRskClient.class);
btcReleaseClient = mock(BtcReleaseClient.class);
bitcoinWrapper = mock(BitcoinWrapper.class);
federationWatcherListener = new FederationWatcherListenerImpl(
btcToRskClientActive, btcToRskClientRetiring, btcReleaseClient);
btcToRskClientActive, btcToRskClientRetiring, btcReleaseClient, bitcoinWrapper);
}

@Test
Expand Down Expand Up @@ -99,6 +102,7 @@ void onProposedFederationChange_whenNewProposedFederationIsNull_shouldNotStartCl

// Assert
verify(btcReleaseClient, never()).start(any(Federation.class));
verify(bitcoinWrapper, never()).addFederationListener(any(Federation.class), any(BtcToRskClient.class));
}

@Test
Expand All @@ -108,6 +112,7 @@ void onProposedFederationChange_whenNewProposedFederationIsValid_shouldStartClie

// Assert
verify(btcReleaseClient).start(FEDERATION);
verify(bitcoinWrapper).addFederationListener(FEDERATION, btcToRskClientActive);
}

@Test
Expand Down

0 comments on commit 1fa8546

Please sign in to comment.