Search in sources :

Example 1 with ScheduleGetInfoResponse

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

the class GetScheduleInfoAnswerTest method recognizesMissingInfoWhenNoCtxGiven.

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

Example 2 with ScheduleGetInfoResponse

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

the class GetScheduleInfoAnswerTest method recognizesMissingInfoWhenCtxGiven.

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

Aggregations

Query (com.hederahashgraph.api.proto.java.Query)2 Response (com.hederahashgraph.api.proto.java.Response)2 ScheduleGetInfoQuery (com.hederahashgraph.api.proto.java.ScheduleGetInfoQuery)2 ScheduleGetInfoResponse (com.hederahashgraph.api.proto.java.ScheduleGetInfoResponse)2 Test (org.junit.jupiter.api.Test)2