Search in sources :

Example 1 with TokenGetInfoResponse

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

the class GetTokenInfoAnswerTest method recognizesMissingInfoWhenNoCtxGiven.

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

Example 2 with TokenGetInfoResponse

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

the class GetTokenInfoAnswerTest method recognizesMissingInfoWhenCtxGiven.

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

Aggregations

Query (com.hederahashgraph.api.proto.java.Query)2 Response (com.hederahashgraph.api.proto.java.Response)2 TokenGetInfoQuery (com.hederahashgraph.api.proto.java.TokenGetInfoQuery)2 TokenGetInfoResponse (com.hederahashgraph.api.proto.java.TokenGetInfoResponse)2 Test (org.junit.jupiter.api.Test)2