Search in sources :

Example 1 with ContractGetInfoResponse

use of com.hederahashgraph.api.proto.java.ContractGetInfoResponse in project hedera-services by hashgraph.

the class GetContractInfoAnswerTest method recognizesMissingInfoWhenNoCtxGiven.

@Test
void recognizesMissingInfoWhenNoCtxGiven() throws Throwable {
    // setup:
    Query sensibleQuery = validQuery(ANSWER_ONLY, 5L, target);
    given(view.infoForContract(asContract(target), aliasManager)).willReturn(Optional.empty());
    // when:
    Response response = subject.responseGiven(sensibleQuery, view, OK, 0L);
    // then:
    ContractGetInfoResponse opResponse = response.getContractGetInfo();
    assertTrue(opResponse.hasHeader(), "Missing response header!");
    assertEquals(INVALID_CONTRACT_ID, opResponse.getHeader().getNodeTransactionPrecheckCode());
}
Also used : ContractGetInfoResponse(com.hederahashgraph.api.proto.java.ContractGetInfoResponse) Response(com.hederahashgraph.api.proto.java.Response) Query(com.hederahashgraph.api.proto.java.Query) ContractGetInfoQuery(com.hederahashgraph.api.proto.java.ContractGetInfoQuery) ContractGetInfoResponse(com.hederahashgraph.api.proto.java.ContractGetInfoResponse) Test(org.junit.jupiter.api.Test)

Example 2 with ContractGetInfoResponse

use of com.hederahashgraph.api.proto.java.ContractGetInfoResponse in project hedera-services by hashgraph.

the class GetContractInfoAnswerTest method recognizesMissingInfoWhenCtxGiven.

@Test
void recognizesMissingInfoWhenCtxGiven() throws Throwable {
    // setup:
    Query sensibleQuery = validQuery(ANSWER_ONLY, 5L, target);
    // when:
    Response response = subject.responseGiven(sensibleQuery, view, OK, 0L, Collections.emptyMap());
    // then:
    ContractGetInfoResponse opResponse = response.getContractGetInfo();
    assertTrue(opResponse.hasHeader(), "Missing response header!");
    assertEquals(INVALID_CONTRACT_ID, opResponse.getHeader().getNodeTransactionPrecheckCode());
    verify(view, never()).infoForContract(any(), any());
}
Also used : ContractGetInfoResponse(com.hederahashgraph.api.proto.java.ContractGetInfoResponse) Response(com.hederahashgraph.api.proto.java.Response) Query(com.hederahashgraph.api.proto.java.Query) ContractGetInfoQuery(com.hederahashgraph.api.proto.java.ContractGetInfoQuery) ContractGetInfoResponse(com.hederahashgraph.api.proto.java.ContractGetInfoResponse) Test(org.junit.jupiter.api.Test)

Aggregations

ContractGetInfoQuery (com.hederahashgraph.api.proto.java.ContractGetInfoQuery)2 ContractGetInfoResponse (com.hederahashgraph.api.proto.java.ContractGetInfoResponse)2 Query (com.hederahashgraph.api.proto.java.Query)2 Response (com.hederahashgraph.api.proto.java.Response)2 Test (org.junit.jupiter.api.Test)2