diff --git a/platform-sdk/platform-apps/tests/ConsistencyTestingTool/src/test/java/com/swirlds/demo/consistency/ConsistencyTestingToolStateTest.java b/platform-sdk/platform-apps/tests/ConsistencyTestingTool/src/test/java/com/swirlds/demo/consistency/ConsistencyTestingToolStateTest.java index 2ef2ba5dd76b..0e18573a2641 100644 --- a/platform-sdk/platform-apps/tests/ConsistencyTestingTool/src/test/java/com/swirlds/demo/consistency/ConsistencyTestingToolStateTest.java +++ b/platform-sdk/platform-apps/tests/ConsistencyTestingTool/src/test/java/com/swirlds/demo/consistency/ConsistencyTestingToolStateTest.java @@ -57,7 +57,6 @@ public class ConsistencyTestingToolStateTest { private static ConsistencyTestingToolState state; - private ConsistencyTestingToolMain main; private Random random; private PlatformStateModifier platformStateModifier; private Platform platform; @@ -101,7 +100,6 @@ void setUp() { state.init(platform, initTrigger, softwareVersion); - main = mock(ConsistencyTestingToolMain.class); random = new Random(); platformStateModifier = mock(PlatformStateModifier.class); round = mock(Round.class); @@ -123,7 +121,7 @@ void setUp() { } @Test - void handleConsensusRoundWithApplicationTransactionEmptySystemTransactionList() { + void handleConsensusRoundWithApplicationTransaction() { final var bytes = Bytes.wrap(new byte[] {1, 1, 1, 1, 1, 1, 1, 1}); when(consensusTransaction.getApplicationTransaction()).thenReturn(bytes); @@ -144,7 +142,6 @@ void handleConsensusRoundWithApplicationTransactionEmptySystemTransactionList() void handleConsensusRoundWithSystemTransaction() { final var stateSignatureTransactionBytes = StateSignatureTransaction.PROTOBUF.toBytes(stateSignatureTransaction); - when(main.encodeSystemTransaction(stateSignatureTransaction)).thenReturn(stateSignatureTransactionBytes); when(consensusTransaction.getApplicationTransaction()).thenReturn(stateSignatureTransactionBytes); doAnswer(invocation -> { @@ -176,7 +173,6 @@ void handleConsensusRoundWithMultipleSystemTransactions() { final var stateSignatureTransactionBytes = StateSignatureTransaction.PROTOBUF.toBytes(stateSignatureTransaction); - when(main.encodeSystemTransaction(stateSignatureTransaction)).thenReturn(stateSignatureTransactionBytes); when(consensusTransaction.getApplicationTransaction()).thenReturn(stateSignatureTransactionBytes); when(secondConsensusTransaction.getApplicationTransaction()).thenReturn(stateSignatureTransactionBytes); when(thirdConsensusTransaction.getApplicationTransaction()).thenReturn(stateSignatureTransactionBytes); @@ -265,6 +261,24 @@ void preHandleEventWithSystemTransaction() { assertThat(consumedTransactions).hasSize(1); } + @Test + void preHandleEventWithApplicationTransaction() { + final var bytes = Bytes.wrap(new byte[] {1, 1, 1, 1, 1, 1, 1, 1}); + when(consensusTransaction.getApplicationTransaction()).thenReturn(bytes); + + doAnswer(invocation -> { + Consumer consumer = invocation.getArgument(0); + consumer.accept(consensusTransaction); + return null; + }) + .when(event) + .forEachTransaction(any()); + + state.preHandle(event, consumer); + + assertThat(consumedTransactions).isEmpty(); + } + @Test void preHandleEventWithDeprecatedSystemTransaction() { when(round.iterator()).thenReturn(Collections.singletonList(event).iterator());