Skip to content

Commit

Permalink
test: Add in-equivalence tests for internal calls
Browse files Browse the repository at this point in the history
Signed-off-by: Bilyana Gospodinova <bilyana.gospodinova14@gmail.com>
  • Loading branch information
bilyana-gospodinova committed Mar 14, 2024
1 parent 2f3c8f1 commit b9f934f
Show file tree
Hide file tree
Showing 7 changed files with 380 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ public SubscriptionResponse subscribeToTopicAndRetrieveMessages(

public CryptoAllowancesResponse getAccountCryptoAllowance(String accountId) {
log.debug("Verify account '{}''s crypto allowance is returned by Mirror Node", accountId);
return callRestEndpoint(
"/accounts/{accountId}/allowances/crypto", CryptoAllowancesResponse.class, accountId);
return callRestEndpoint("/accounts/{accountId}/allowances/crypto", CryptoAllowancesResponse.class, accountId);
}

public CryptoAllowancesResponse getAccountCryptoAllowanceBySpender(String accountId, String spenderId) {
Expand Down Expand Up @@ -211,8 +210,7 @@ public ContractResultsResponse getContractResultsById(String contractId) {

public ContractResult getContractResultByTransactionId(String transactionId) {
log.debug("Verify contract result '{}' is returned by Mirror Node", transactionId);
return callRestEndpoint(
"/contracts/results/{transactionId}", ContractResult.class, transactionId);
return callRestEndpoint("/contracts/results/{transactionId}", ContractResult.class, transactionId);
}

public ContractActionsResponse getContractActions(String transactionId) {
Expand Down Expand Up @@ -254,8 +252,7 @@ public NetworkStakeResponse getNetworkStake() {

public Nft getNftInfo(String tokenId, long serialNumber) {
log.debug("Verify serial number '{}' for token '{}' is returned by Mirror Node", serialNumber, tokenId);
return callRestEndpoint(
"/tokens/{tokenId}/nfts/{serialNumber}", Nft.class, tokenId, serialNumber);
return callRestEndpoint("/tokens/{tokenId}/nfts/{serialNumber}", Nft.class, tokenId, serialNumber);
}

public NftTransactionHistory getNftTransactions(TokenId tokenId, Long serialNumber) {
Expand Down Expand Up @@ -296,10 +293,7 @@ public TokenRelationshipResponse getTokenRelationships(AccountId accountId, Toke
accountId,
tokenId);
return callRestEndpoint(
"/accounts/{accountId}/tokens?token.id={tokenId}",
TokenRelationshipResponse.class,
accountId,
tokenId);
"/accounts/{accountId}/tokens?token.id={tokenId}", TokenRelationshipResponse.class, accountId, tokenId);
}

public AccountBalanceTransactions getAccountDetailsUsingAlias(@NonNull AccountId accountId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hedera.mirror.test.e2e.acceptance.response;

import com.hedera.mirror.test.e2e.acceptance.util.ContractCallResponseWrapper;
Expand All @@ -7,12 +23,25 @@
* networkResponse, errorMessage) or from the mirror node (with initialized contractCallResponse).
* This is needed for the NetworkAdapter logic.
*/
public record GeneralContractExecutionResponse(String transactionId, NetworkTransactionResponse networkResponse, String errorMessage, ContractCallResponseWrapper contractCallResponse) {
public record GeneralContractExecutionResponse(
String transactionId,
NetworkTransactionResponse networkResponse,
String errorMessage,
ContractCallResponseWrapper contractCallResponse) {
public GeneralContractExecutionResponse(ContractCallResponseWrapper contractCallResponse) {
this(null, null, null, contractCallResponse);
}

public GeneralContractExecutionResponse(String transactionId, NetworkTransactionResponse networkResponse, String errorMessage) {
public GeneralContractExecutionResponse(
String transactionId, NetworkTransactionResponse networkResponse, String errorMessage) {
this(transactionId, networkResponse, errorMessage, null);
}
}

public String getMirrorNodeResponseAsString() {
return contractCallResponse.getResult().substring(2);
}

public byte[] getMirrorNodeResponseAsBytes() {
return contractCallResponse.getResultAsBytes().toArray();
}
}

0 comments on commit b9f934f

Please sign in to comment.