use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class GetAccountBalanceAnswerTest method requiresOkMetaValidity.
@Test
void requiresOkMetaValidity() {
// setup:
AccountID id = asAccount(accountIdLit);
// given:
CryptoGetAccountBalanceQuery op = CryptoGetAccountBalanceQuery.newBuilder().setAccountID(id).build();
Query query = Query.newBuilder().setCryptogetAccountBalance(op).build();
// when:
Response response = subject.responseGiven(query, view, PLATFORM_NOT_ACTIVE);
ResponseCodeEnum status = response.getCryptogetAccountBalance().getHeader().getNodeTransactionPrecheckCode();
// expect:
assertEquals(PLATFORM_NOT_ACTIVE, status);
assertEquals(id, response.getCryptogetAccountBalance().getAccountID());
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class GetAccountInfoAnswerTest method usesValidator.
@Test
void usesValidator() throws Throwable {
// setup:
Query query = validQuery(COST_ANSWER, fee, target);
given(optionValidator.queryableAccountStatus(EntityNum.fromAccountId(payerId), accounts)).willReturn(ACCOUNT_DELETED);
// when:
ResponseCodeEnum validity = subject.checkValidity(query, view);
// then:
assertEquals(ACCOUNT_DELETED, validity);
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class GetScheduleInfoAnswerTest method usesViewToValidate.
@Test
void usesViewToValidate() throws Throwable {
// setup:
Query query = validQuery(COST_ANSWER, fee, scheduleID);
given(view.scheduleExists(scheduleID)).willReturn(false);
// when:
ResponseCodeEnum validity = subject.checkValidity(query, view);
// then:
assertEquals(INVALID_SCHEDULE_ID, validity);
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class GetTokenInfoAnswerTest method usesViewToValidate.
@Test
void usesViewToValidate() throws Throwable {
// setup:
Query query = validQuery(COST_ANSWER, fee, tokenId);
given(view.tokenExists(tokenId)).willReturn(false);
// when:
ResponseCodeEnum validity = subject.checkValidity(query, view);
// then:
assertEquals(INVALID_TOKEN_ID, validity);
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class GetTokenNftInfoAnswerTest method validatesWrongSerialNumber.
@Test
void validatesWrongSerialNumber() throws Throwable {
// setup:
nftId = NftID.newBuilder().setTokenID(nftId.getTokenID()).build();
Query query = validQuery(COST_ANSWER, fee, nftId);
// when:
ResponseCodeEnum validity = subject.checkValidity(query, view);
// then:
assertEquals(INVALID_TOKEN_NFT_SERIAL_NUMBER, validity);
}
Aggregations