Search in sources :

Example 11 with CONTRACT

use of com.hedera.mirror.common.domain.entity.EntityType.CONTRACT 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

Contract (com.hedera.mirror.common.domain.contract.Contract)11 EntityId (com.hedera.mirror.common.domain.entity.EntityId)11 ACCOUNT (com.hedera.mirror.common.domain.entity.EntityType.ACCOUNT)11 CONTRACT (com.hedera.mirror.common.domain.entity.EntityType.CONTRACT)11 DomainUtils (com.hedera.mirror.common.util.DomainUtils)11 AliasNotFoundException (com.hedera.mirror.importer.exception.AliasNotFoundException)11 AccountID (com.hederahashgraph.api.proto.java.AccountID)11 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)11 Assertions (org.junit.jupiter.api.Assertions)11 Test (org.junit.jupiter.api.Test)11 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)11 ContractID (com.hederahashgraph.api.proto.java.ContractID)9 Range (com.google.common.collect.Range)6 EntityIdEndec (com.hedera.mirror.common.domain.entity.EntityIdEndec)6 EntityType (com.hedera.mirror.common.domain.entity.EntityType)6 RecordItem (com.hedera.mirror.common.domain.transaction.RecordItem)6 Transaction (com.hedera.mirror.common.domain.transaction.Transaction)6 PartialDataAction (com.hedera.mirror.importer.parser.PartialDataAction)6 RecordParserProperties (com.hedera.mirror.importer.parser.record.RecordParserProperties)6 Utility (com.hedera.mirror.importer.util.Utility)6