use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class GetContractInfoAnswerTest method returnsInvalidContractIdFromValidator.
@Test
void returnsInvalidContractIdFromValidator() throws Throwable {
// setup:
Query query = validQuery(COST_ANSWER, fee, target);
given(optionValidator.queryableContractStatus(asContract(target), contracts)).willReturn(INVALID_CONTRACT_ID);
given(view.contracts()).willReturn(contracts);
// when:
ResponseCodeEnum validity = subject.checkValidity(query, view);
// then:
assertEquals(INVALID_CONTRACT_ID, validity);
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class GetMerkleTopicInfoAnswerTest method syntaxCheckValidatesTidIfPresent.
@Test
void syntaxCheckValidatesTidIfPresent() {
// setup:
TopicID tid = asTopic(idLit);
// given:
ConsensusGetTopicInfoQuery op = ConsensusGetTopicInfoQuery.newBuilder().setTopicID(tid).build();
Query query = Query.newBuilder().setConsensusGetTopicInfo(op).build();
// and:
given(optionValidator.queryableTopicStatus(tid, topics)).willReturn(TOPIC_EXPIRED);
// when:
ResponseCodeEnum status = subject.checkValidity(query, view);
// expect:
assertEquals(TOPIC_EXPIRED, status);
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class GetMerkleTopicInfoAnswerTest method syntaxCheckRequiresId.
@Test
void syntaxCheckRequiresId() {
// given:
ConsensusGetTopicInfoQuery op = ConsensusGetTopicInfoQuery.newBuilder().build();
Query query = Query.newBuilder().setConsensusGetTopicInfo(op).build();
// when:
ResponseCodeEnum status = subject.checkValidity(query, view);
// expect:
assertEquals(INVALID_TOPIC_ID, status);
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class GetMerkleTopicInfoAnswerTest method requiresOkMetaValidity.
@Test
void requiresOkMetaValidity() {
// setup:
TopicID id = asTopic(idLit);
// given:
ConsensusGetTopicInfoQuery op = ConsensusGetTopicInfoQuery.newBuilder().setTopicID(id).build();
Query query = Query.newBuilder().setConsensusGetTopicInfo(op).build();
// when:
Response response = subject.responseGiven(query, view, PLATFORM_NOT_ACTIVE);
ResponseCodeEnum status = response.getConsensusGetTopicInfo().getHeader().getNodeTransactionPrecheckCode();
// expect:
assertEquals(PLATFORM_NOT_ACTIVE, status);
assertEquals(id, response.getConsensusGetTopicInfo().getTopicID());
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class AbstractAnswerTest method usesValidator.
@Test
void usesValidator() throws Throwable {
given(validityCheck.apply(query, view)).willReturn(FILE_DELETED);
// when:
ResponseCodeEnum validity = subject.checkValidity(query, view);
// then:
assertEquals(FILE_DELETED, validity);
}
Aggregations