-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGetInvestmentTransactionsTest.java
36 lines (31 loc) · 1.71 KB
/
GetInvestmentTransactionsTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package ai.pluggy.client.integration;
import static ai.pluggy.client.integration.helper.InvestmentHelper.getPluggyBankInvestments;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import ai.pluggy.client.request.InvestmentTransactionsSearchRequest;
import ai.pluggy.client.response.InvestmentTransactionsResponse;
import ai.pluggy.client.response.InvestmentsResponse;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;
import retrofit2.Response;
public class GetInvestmentTransactionsTest extends BaseApiIntegrationTest {
@SneakyThrows
@Test
void getTransactions_byExistingInvestmentId_ok() {
// precondition: get existing investments
InvestmentsResponse investments = getPluggyBankInvestments(client);
// get first investment id to get the transactions from the investment
String firstInvestmentId = investments.getResults().get(0).getId();
// get investment transactions
Response<InvestmentTransactionsResponse> investmentTransactionsResponse = client.service()
.getInvestmentTransactions(firstInvestmentId, new InvestmentTransactionsSearchRequest().pageSize(20))
.execute();
// expect investment response to be valid
assertTrue(investmentTransactionsResponse.isSuccessful());
InvestmentTransactionsResponse investmentTransactions = investmentTransactionsResponse.body();
assertNotNull(investmentTransactions);
// expect investment transactions to be valid and have at least one transaction
assertNotNull(investmentTransactions.getResults());
assertTrue(investmentTransactions.getResults().size() > 0);
}
}