Skip to content

Commit

Permalink
refactor: 17991
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Malygin <[email protected]>
  • Loading branch information
imalygin committed Feb 21, 2025
1 parent 77ebedc commit 944cc1e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.mockito.Mockito.when;

import com.swirlds.common.context.PlatformContext;
import com.swirlds.common.merkle.MerkleNode;
import com.swirlds.common.platform.NodeId;
import com.swirlds.common.test.fixtures.platform.TestPlatformContextBuilder;
import com.swirlds.platform.roster.RosterRetriever;
Expand Down Expand Up @@ -52,6 +53,7 @@ public TransactionHandlerTester(final AddressBook addressBook) {
platformState = new PlatformStateValueAccumulator();

consensusState = mock(MerkleNodeState.class);
when(consensusState.getRoot()).thenReturn(mock(MerkleNode.class));
platformStateFacade = mock(TestPlatformStateFacade.class);

stateLifecycles = mock(StateLifecycles.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.swirlds.common.context.PlatformContext;
import com.swirlds.common.test.fixtures.platform.TestPlatformContextBuilder;
import com.swirlds.platform.internal.ConsensusRound;
import com.swirlds.platform.state.MerkleNodeState;
import com.swirlds.platform.state.hasher.DefaultStateHasher;
import com.swirlds.platform.state.hasher.StateHasher;
import com.swirlds.platform.wiring.components.StateAndRound;
Expand All @@ -30,8 +31,10 @@ void normalOperation() {

// mock a state
final SignedState signedState = mock(SignedState.class);
final MerkleNodeState merkleNodeState = mock(MerkleNodeState.class);
final ReservedSignedState reservedSignedState = mock(ReservedSignedState.class);
when(reservedSignedState.get()).thenReturn(signedState);
when(signedState.getState()).thenReturn(merkleNodeState);

final StateAndRound stateAndRound =
new StateAndRound(reservedSignedState, mock(ConsensusRound.class), mock(ConcurrentLinkedQueue.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import com.swirlds.common.context.PlatformContext;
import com.swirlds.common.merkle.MerkleNode;
import com.swirlds.common.test.fixtures.platform.TestPlatformContextBuilder;
import com.swirlds.common.utility.ValueReference;
import com.swirlds.component.framework.model.WiringModel;
Expand Down Expand Up @@ -34,11 +36,13 @@ void basicTest() {
final PlatformContext platformContext =
TestPlatformContextBuilder.create().build();

MerkleNodeState mock = mock(MerkleNodeState.class);
MerkleNodeState mockState = mock(MerkleNodeState.class);
MerkleNode root = mock(MerkleNode.class);
when(mockState.getRoot()).thenReturn(root);
final SignedState signedState = new SignedState(
platformContext.getConfiguration(),
mock(SignatureVerifier.class),
mock,
mockState,
"create",
false,
false,
Expand Down

0 comments on commit 944cc1e

Please sign in to comment.