use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class GetFileContentsAnswerTest method usesValidator.
@Test
void usesValidator() throws Throwable {
// setup:
Query query = validQuery(COST_ANSWER, fee, target);
given(optionValidator.queryableFileStatus(asFile(target), view)).willReturn(FILE_DELETED);
// when:
ResponseCodeEnum validity = subject.checkValidity(query, view);
// then:
assertEquals(FILE_DELETED, validity);
// and:
verify(optionValidator).queryableFileStatus(any(), any());
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class GetFileContentsAnswerTest method getsCostAnswerResponse.
@Test
void getsCostAnswerResponse() throws Throwable {
// setup:
Query query = validQuery(COST_ANSWER, fee, target);
// when:
Response response = subject.responseGiven(query, view, OK, fee);
// then:
assertTrue(response.hasFileGetContents());
assertEquals(asFile(target), response.getFileGetContents().getFileContents().getFileID());
assertEquals(OK, response.getFileGetContents().getHeader().getNodeTransactionPrecheckCode());
assertEquals(COST_ANSWER, response.getFileGetContents().getHeader().getResponseType());
assertEquals(fee, response.getFileGetContents().getHeader().getCost());
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class GetFileContentsAnswerTest method getsInvalidResponse.
@Test
void getsInvalidResponse() throws Throwable {
// setup:
Query query = validQuery(COST_ANSWER, fee, target);
// when:
Response response = subject.responseGiven(query, view, FILE_DELETED, fee);
// then:
assertTrue(response.hasFileGetContents());
assertEquals(asFile(target), response.getFileGetContents().getFileContents().getFileID());
assertEquals(FILE_DELETED, response.getFileGetContents().getHeader().getNodeTransactionPrecheckCode());
assertEquals(COST_ANSWER, response.getFileGetContents().getHeader().getResponseType());
assertEquals(fee, response.getFileGetContents().getHeader().getCost());
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class GetFileInfoAnswerTest method getsCostAnswerResponse.
@Test
void getsCostAnswerResponse() throws Throwable {
// setup:
Query query = validQuery(COST_ANSWER, fee, target);
// when:
Response response = subject.responseGiven(query, view, OK, fee);
// then:
assertTrue(response.hasFileGetInfo());
assertEquals(OK, response.getFileGetInfo().getHeader().getNodeTransactionPrecheckCode());
assertEquals(COST_ANSWER, response.getFileGetInfo().getHeader().getResponseType());
assertEquals(fee, response.getFileGetInfo().getHeader().getCost());
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class GetFileInfoAnswerTest method getsInvalidResponse.
@Test
void getsInvalidResponse() throws Throwable {
// setup:
Query query = validQuery(COST_ANSWER, fee, target);
// when:
Response response = subject.responseGiven(query, view, FILE_DELETED, fee);
// then:
assertTrue(response.hasFileGetInfo());
assertEquals(FILE_DELETED, response.getFileGetInfo().getHeader().getNodeTransactionPrecheckCode());
assertEquals(COST_ANSWER, response.getFileGetInfo().getHeader().getResponseType());
assertEquals(fee, response.getFileGetInfo().getHeader().getCost());
}
Aggregations