Search in sources :

Example 11 with AliasNotFoundException

use of com.hedera.mirror.importer.exception.AliasNotFoundException in project hedera-mirror-node by hashgraph.

the class CryptoApproveAllowanceTransactionHandlerTest method updateTransactionWithAliasNotFoundAndPartialDataActionSkip.

@Test
void updateTransactionWithAliasNotFoundAndPartialDataActionSkip() {
    recordParserProperties.setPartialDataAction(PartialDataAction.SKIP);
    var alias = DomainUtils.fromBytes(domainBuilder.key());
    var recordItem = recordItemBuilder.cryptoApproveAllowance().transactionBody(b -> {
        b.getCryptoAllowancesBuilderList().forEach(builder -> builder.getOwnerBuilder().setAlias(alias));
        b.getNftAllowancesBuilderList().forEach(builder -> builder.getOwnerBuilder().setAlias(alias));
        b.getTokenAllowancesBuilderList().forEach(builder -> builder.getOwnerBuilder().setAlias(alias));
    }).build();
    var transaction = domainBuilder.transaction().get();
    when(entityIdService.lookup(AccountID.newBuilder().setAlias(alias).build())).thenThrow(new AliasNotFoundException("alias", EntityType.ACCOUNT));
    transactionHandler.updateTransaction(transaction, recordItem);
    verifyNoInteractions(entityListener);
}
Also used : NftId(com.hedera.mirror.common.domain.token.NftId) BeforeEach(org.junit.jupiter.api.BeforeEach) PartialDataAction(com.hedera.mirror.importer.parser.PartialDataAction) EntityId(com.hedera.mirror.common.domain.entity.EntityId) BoolValue(com.google.protobuf.BoolValue) EnumSource(org.junit.jupiter.params.provider.EnumSource) EntityType(com.hedera.mirror.common.domain.entity.EntityType) Mockito.verifyNoInteractions(org.mockito.Mockito.verifyNoInteractions) RecordParserProperties(com.hedera.mirror.importer.parser.record.RecordParserProperties) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) AliasNotFoundException(com.hedera.mirror.importer.exception.AliasNotFoundException) TestUtils(com.hedera.mirror.importer.TestUtils) AccountID(com.hederahashgraph.api.proto.java.AccountID) DomainUtils(com.hedera.mirror.common.util.DomainUtils) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) Range(com.google.common.collect.Range) Mockito.times(org.mockito.Mockito.times) CryptoAllowance(com.hedera.mirror.common.domain.entity.CryptoAllowance) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) NftAllowance(com.hedera.mirror.common.domain.entity.NftAllowance) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Nft(com.hedera.mirror.common.domain.token.Nft) TokenID(com.hederahashgraph.api.proto.java.TokenID) Assertions(org.junit.jupiter.api.Assertions) TokenAllowance(com.hedera.mirror.common.domain.entity.TokenAllowance) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Transaction(com.hedera.mirror.common.domain.transaction.Transaction) CryptoApproveAllowanceTransactionBody(com.hederahashgraph.api.proto.java.CryptoApproveAllowanceTransactionBody) AliasNotFoundException(com.hedera.mirror.importer.exception.AliasNotFoundException) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

AliasNotFoundException (com.hedera.mirror.importer.exception.AliasNotFoundException)11 Range (com.google.common.collect.Range)10 EntityId (com.hedera.mirror.common.domain.entity.EntityId)10 EntityType (com.hedera.mirror.common.domain.entity.EntityType)10 Transaction (com.hedera.mirror.common.domain.transaction.Transaction)10 DomainUtils (com.hedera.mirror.common.util.DomainUtils)10 PartialDataAction (com.hedera.mirror.importer.parser.PartialDataAction)10 RecordParserProperties (com.hedera.mirror.importer.parser.record.RecordParserProperties)10 AccountID (com.hederahashgraph.api.proto.java.AccountID)10 ResponseCodeEnum (com.hederahashgraph.api.proto.java.ResponseCodeEnum)10 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)10 Assertions (org.junit.jupiter.api.Assertions)10 Test (org.junit.jupiter.api.Test)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)10 EnumSource (org.junit.jupiter.params.provider.EnumSource)10 Mockito.verify (org.mockito.Mockito.verify)10 Mockito.verifyNoInteractions (org.mockito.Mockito.verifyNoInteractions)10 Mockito.when (org.mockito.Mockito.when)10 EntityIdEndec (com.hedera.mirror.common.domain.entity.EntityIdEndec)8 ACCOUNT (com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT)8