diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoDeleteHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoDeleteHandlerTest.java index 30ddf1df2091..7dbcbf852234 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoDeleteHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoDeleteHandlerTest.java @@ -34,11 +34,13 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertIterableEquals; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.lenient; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import com.hedera.hapi.node.base.AccountID; @@ -55,6 +57,10 @@ import com.hedera.node.app.service.token.impl.test.handlers.util.CryptoHandlerTestBase; import com.hedera.node.app.service.token.impl.validators.StakingValidator; import com.hedera.node.app.service.token.records.CryptoDeleteStreamBuilder; +import com.hedera.node.app.spi.fees.FeeCalculator; +import com.hedera.node.app.spi.fees.FeeCalculatorFactory; +import com.hedera.node.app.spi.fees.FeeContext; +import com.hedera.node.app.spi.fees.Fees; import com.hedera.node.app.spi.fixtures.workflows.FakePreHandleContext; import com.hedera.node.app.spi.metrics.StoreMetricsService; import com.hedera.node.app.spi.store.StoreFactory; @@ -68,7 +74,9 @@ import com.swirlds.state.spi.WritableStates; import java.util.List; import java.util.Map; +import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -384,6 +392,19 @@ void failsIfEitherDeleteOrTransferAccountDoesntExist() throws PreCheckException .has(responseCode(ACCOUNT_ID_DOES_NOT_EXIST)); } + @Test + @DisplayName("check that fees are 1 for delete account trx") + void testCalculateFeesReturnsCorrectFeeForDeleteAccount() { + final var feeCtx = mock(FeeContext.class); + final var feeCalcFact = mock(FeeCalculatorFactory.class); + final var feeCalc = mock(FeeCalculator.class); + given(feeCtx.feeCalculatorFactory()).willReturn(feeCalcFact); + given(feeCalcFact.feeCalculator(any())).willReturn(feeCalc); + given(feeCalc.legacyCalculate(any())).willReturn(new Fees(1, 0, 0)); + + Assertions.assertThat(subject.calculateFees(feeCtx)).isEqualTo(new Fees(1, 0, 0)); + } + private TransactionBody deleteAccountTransaction( final AccountID deleteAccountId, final AccountID transferAccountId) { final var transactionID = TransactionID.newBuilder().accountID(id).transactionValidStart(consensusTimestamp);