Search in sources :

Example 1 with RecordItemBuilder

use of com.hedera.mirror.importer.parser.domain.RecordItemBuilder in project hedera-mirror-node by hashgraph.

the class ContractUpdateTransactionHandlerTest method updateTransactionDeclineReward.

@Test
void updateTransactionDeclineReward() {
    RecordItemBuilder recordItemBuilder = new RecordItemBuilder();
    RecordItem withDeclineValueSet = recordItemBuilder.contractUpdate().transactionBody(body -> body.setDeclineReward(BoolValue.of(false)).clearStakedAccountId().clearStakedNodeId()).build();
    setupForContractUpdateTransactionTest(withDeclineValueSet, t -> assertThat(t).returns(false, Contract::isDeclineReward).returns(null, Contract::getStakedNodeId).returns(null, Contract::getStakedAccountId).returns(Utility.getEpochDay(withDeclineValueSet.getConsensusTimestamp()), Contract::getStakePeriodStart));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) Contract(com.hedera.mirror.common.domain.contract.Contract) PartialDataAction(com.hedera.mirror.importer.parser.PartialDataAction) EntityId(com.hedera.mirror.common.domain.entity.EntityId) BoolValue(com.google.protobuf.BoolValue) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) EnumSource(org.junit.jupiter.params.provider.EnumSource) ContractUpdateTransactionBody(com.hederahashgraph.api.proto.java.ContractUpdateTransactionBody) EntityType(com.hedera.mirror.common.domain.entity.EntityType) Mockito.verifyNoInteractions(org.mockito.Mockito.verifyNoInteractions) RecordParserProperties(com.hedera.mirror.importer.parser.record.RecordParserProperties) ContractID(com.hederahashgraph.api.proto.java.ContractID) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) AliasNotFoundException(com.hedera.mirror.importer.exception.AliasNotFoundException) AccountID(com.hederahashgraph.api.proto.java.AccountID) Utility(com.hedera.mirror.importer.util.Utility) RecordItemBuilder(com.hedera.mirror.importer.parser.domain.RecordItemBuilder) DomainUtils(com.hedera.mirror.common.util.DomainUtils) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) EntityIdEndec(com.hedera.mirror.common.domain.entity.EntityIdEndec) Range(com.google.common.collect.Range) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) CONTRACT(com.hedera.mirror.common.domain.entity.EntityType.CONTRACT) Consumer(java.util.function.Consumer) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Assertions(org.junit.jupiter.api.Assertions) ACCOUNT(com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Transaction(com.hedera.mirror.common.domain.transaction.Transaction) RecordItemBuilder(com.hedera.mirror.importer.parser.domain.RecordItemBuilder) Contract(com.hedera.mirror.common.domain.contract.Contract) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Range (com.google.common.collect.Range)1 BoolValue (com.google.protobuf.BoolValue)1 Contract (com.hedera.mirror.common.domain.contract.Contract)1 EntityId (com.hedera.mirror.common.domain.entity.EntityId)1 EntityIdEndec (com.hedera.mirror.common.domain.entity.EntityIdEndec)1 EntityType (com.hedera.mirror.common.domain.entity.EntityType)1 ACCOUNT (com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT)1 CONTRACT (com.hedera.mirror.common.domain.entity.EntityType.CONTRACT)1 RecordItem (com.hedera.mirror.common.domain.transaction.RecordItem)1 Transaction (com.hedera.mirror.common.domain.transaction.Transaction)1 DomainUtils (com.hedera.mirror.common.util.DomainUtils)1 AliasNotFoundException (com.hedera.mirror.importer.exception.AliasNotFoundException)1 PartialDataAction (com.hedera.mirror.importer.parser.PartialDataAction)1 RecordItemBuilder (com.hedera.mirror.importer.parser.domain.RecordItemBuilder)1 RecordParserProperties (com.hedera.mirror.importer.parser.record.RecordParserProperties)1 Utility (com.hedera.mirror.importer.util.Utility)1 AccountID (com.hederahashgraph.api.proto.java.AccountID)1 ContractID (com.hederahashgraph.api.proto.java.ContractID)1 ContractUpdateTransactionBody (com.hederahashgraph.api.proto.java.ContractUpdateTransactionBody)1 ResponseCodeEnum (com.hederahashgraph.api.proto.java.ResponseCodeEnum)1