use of com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT in project hedera-mirror-node by hashgraph.
the class ContractUpdateTransactionHandlerTest method updateTransactionThrowsWithAliasNotFound.
@ParameterizedTest(name = "{0}")
@EnumSource(value = PartialDataAction.class, names = { "DEFAULT", "ERROR" })
void updateTransactionThrowsWithAliasNotFound(PartialDataAction partialDataAction) {
// given
recordParserProperties.setPartialDataAction(partialDataAction);
var alias = DomainUtils.fromBytes(domainBuilder.key());
var recordItem = recordItemBuilder.contractUpdate().transactionBody(b -> b.getAutoRenewAccountIdBuilder().setAlias(alias)).build();
var contractId = EntityId.of(recordItem.getRecord().getReceipt().getContractID());
var timestamp = recordItem.getConsensusTimestamp();
var transaction = domainBuilder.transaction().customize(t -> t.consensusTimestamp(timestamp).entityId(contractId)).get();
when(entityIdService.lookup(AccountID.newBuilder().setAlias(alias).build())).thenThrow(new AliasNotFoundException("alias", ACCOUNT));
// when, then
assertThrows(AliasNotFoundException.class, () -> transactionHandler.updateTransaction(transaction, recordItem));
}
use of com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT in project hedera-mirror-node by hashgraph.
the class ContractUpdateTransactionHandlerTest method updateTransactionWithAliasNotFoundAndPartialDataActionSkip.
@Test
void updateTransactionWithAliasNotFoundAndPartialDataActionSkip() {
recordParserProperties.setPartialDataAction(PartialDataAction.SKIP);
var alias = DomainUtils.fromBytes(domainBuilder.key());
var recordItem = recordItemBuilder.contractUpdate().transactionBody(b -> b.getAutoRenewAccountIdBuilder().setAlias(alias)).build();
var contractId = EntityId.of(recordItem.getRecord().getReceipt().getContractID());
var timestamp = recordItem.getConsensusTimestamp();
var transaction = domainBuilder.transaction().customize(t -> t.consensusTimestamp(timestamp).entityId(contractId)).get();
when(entityIdService.lookup(AccountID.newBuilder().setAlias(alias).build())).thenThrow(new AliasNotFoundException("alias", ACCOUNT));
transactionHandler.updateTransaction(transaction, recordItem);
assertContractUpdate(timestamp, contractId, t -> assertThat(t).returns(null, Contract::getAutoRenewAccountId).satisfies(c -> assertThat(c.getAutoRenewPeriod()).isPositive()).satisfies(c -> assertThat(c.getExpirationTimestamp()).isPositive()).satisfies(c -> assertThat(c.getKey()).isNotEmpty()).satisfies(c -> assertThat(c.getMaxAutomaticTokenAssociations()).isPositive()).satisfies(c -> assertThat(c.getMemo()).isNotEmpty()).satisfies(c -> assertThat(c.getPublicKey()).isNotEmpty()).satisfies(c -> assertThat(c.getProxyAccountId().getId()).isPositive()));
}
Aggregations