Skip to content

Commit

Permalink
fixed test cases with Finance.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignesh Kennadi committed Sep 13, 2024
1 parent fb295c4 commit 1b5bbdd
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions src/test/java/com/xero/api/client/FinanceApiTest.java
Original file line number Diff line number Diff line change
@@ -1,45 +1,17 @@
package com.xero.api.client;

import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.*;

import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.hamcrest.core.Every.everyItem;

import com.xero.api.ApiClient;
import com.xero.api.XeroApiException;
import com.xero.api.client.*;
import com.xero.models.finance.*;

import java.io.File;
import java.net.URL;

import com.google.api.client.auth.oauth2.BearerToken;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;

import org.threeten.bp.*;
import java.io.IOException;
import com.fasterxml.jackson.core.type.TypeReference;

import java.util.Calendar;
import java.util.Map;
import java.util.UUID;

import java.util.*;

import org.apache.commons.io.IOUtils;

public class FinanceApiTest {

ApiClient defaultClient;
Expand All @@ -55,7 +27,7 @@ public void setUp() {
accessToken = "123";
xeroTenantId = "xyz";

defaultClient = new ApiClient("https://73cb2c15-a3e8-4230-86d6-8af203c03b5f.mock.pstmn.io/finance.xro/1.0",null,null,null,null);
defaultClient = new ApiClient("http://127.0.0.1:4014",null,null,null,null);
financeApi = FinanceApi.getInstance(defaultClient);

// ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs
Expand Down Expand Up @@ -116,7 +88,7 @@ public void testGetAccountingActivityLockHistory() throws Exception {
try {
LockHistoryResponse response = financeApi.getAccountingActivityLockHistory(accessToken, "73151de8-3676-4887-a021-edec960dd537", null);
assertThat(response.getOrganisationId().toString(), (equalTo("73151de8-3676-4887-a021-edec960dd537")));
assertThat(response.getLockDates().get(1).getUpdatedDateUtc().toString(), (equalTo("2019-01-20T10:50:03Z")));
assertThat(response.getLockDates().get(1).getUpdatedDateUtc().toString(), (equalTo("2019-01-21T10:59:33Z")));

} catch (XeroApiException xe) {
System.out.println(xe.toString());
Expand Down Expand Up @@ -212,7 +184,6 @@ public void testGetFinancialStatementContactsRevenue() throws Exception {
System.out.println("@Test - getFinancialStatementContactsRevenue");
List<UUID> contacts = new ArrayList<UUID>();
contacts.add(UUID.fromString("1f580fe2-0659-31ee-eeb4-5c49d15d8bfa"));
contacts.add(UUID.fromString("20e94281-4751-fb7e-ee5e-96b43ae93c8a"));
try {
IncomeByContactResponse response = financeApi.getFinancialStatementContactsRevenue(accessToken, "73151de8-3676-4887-a021-edec960dd537",contacts,true,null,null);
assertThat(response.getContacts().get(0).getName(), (equalTo("FirstContact")));
Expand All @@ -226,7 +197,6 @@ public void testGetFinancialStatementContactsExpense() throws Exception {
System.out.println("@Test - getFinancialStatementContactsExpense");
List<UUID> contacts = new ArrayList<UUID>();
contacts.add(UUID.fromString("1f580fe2-0659-31ee-eeb4-5c49d15d8bfa"));
contacts.add(UUID.fromString("20e94281-4751-fb7e-ee5e-96b43ae93c8a"));
try {
IncomeByContactResponse response = financeApi.getFinancialStatementContactsExpense(accessToken, "73151de8-3676-4887-a021-edec960dd537",contacts,true,null,null);
assertThat(response.getContacts().get(0).getName(), (equalTo("FirstContact")));
Expand Down

0 comments on commit 1b5bbdd

Please sign in to comment.