From 92f36ed03a4d054b7517f1ac1a8af7bf99b03b17 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Tue, 22 Sep 2020 22:08:01 -0300 Subject: [PATCH] Add get default payment acct helper --- .../java/bisq/apitest/method/MethodTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/apitest/src/test/java/bisq/apitest/method/MethodTest.java b/apitest/src/test/java/bisq/apitest/method/MethodTest.java index ad971eea09..5c4de14c5c 100644 --- a/apitest/src/test/java/bisq/apitest/method/MethodTest.java +++ b/apitest/src/test/java/bisq/apitest/method/MethodTest.java @@ -20,16 +20,25 @@ package bisq.apitest.method; import bisq.proto.grpc.CreatePaymentAccountRequest; import bisq.proto.grpc.GetBalanceRequest; import bisq.proto.grpc.GetFundingAddressesRequest; +import bisq.proto.grpc.GetPaymentAccountsRequest; import bisq.proto.grpc.LockWalletRequest; import bisq.proto.grpc.RegisterDisputeAgentRequest; import bisq.proto.grpc.RemoveWalletPasswordRequest; import bisq.proto.grpc.SetWalletPasswordRequest; import bisq.proto.grpc.UnlockWalletRequest; +import protobuf.PaymentAccount; + +import java.util.stream.Collectors; + +import org.junit.jupiter.api.Assertions; + import static bisq.common.app.DevEnv.DEV_PRIVILEGE_PRIV_KEY; import static bisq.core.payment.payload.PaymentMethod.PERFECT_MONEY; import static bisq.core.support.dispute.agent.DisputeAgent.DisputeAgentType.MEDIATOR; import static bisq.core.support.dispute.agent.DisputeAgent.DisputeAgentType.REFUNDAGENT; +import static java.util.Comparator.comparing; +import static org.junit.jupiter.api.Assertions.*; @@ -107,6 +116,18 @@ public class MethodTest extends ApiTestCase { .build(); } + protected final PaymentAccount getDefaultPerfectDummyPaymentAccount(BisqAppConfig bisqAppConfig) { + var getPaymentAccountsRequest = GetPaymentAccountsRequest.newBuilder().build(); + var paymentAccountsService = grpcStubs(bisqAppConfig).paymentAccountsService; + PaymentAccount paymentAccount = paymentAccountsService.getPaymentAccounts(getPaymentAccountsRequest) + .getPaymentAccountsList() + .stream() + .sorted(comparing(protobuf.PaymentAccount::getCreationDate)) + .collect(Collectors.toList()).get(0); + assertEquals("PerfectMoney dummy", paymentAccount.getAccountName()); + return paymentAccount; + } + // Static conveniences for test methods and test case fixture setups. protected static RegisterDisputeAgentRequest createRegisterDisputeAgentRequest(String disputeAgentType) {