Skip to content

Commit

Permalink
Fixed test cases in payroll au api
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignesh Kennadi committed Sep 20, 2024
1 parent f133c1b commit 5119b37
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 292 deletions.
29 changes: 1 addition & 28 deletions src/test/java/com/xero/api/client/PayrollAuApiEmployeeTest.java
Original file line number Diff line number Diff line change
@@ -1,44 +1,17 @@
package com.xero.api.client;

import static org.junit.Assert.assertTrue;

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.client.*;
import com.xero.models.payrollau.*;

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.io.File;
import java.io.IOException;

import org.apache.commons.io.IOUtils;

import java.util.Calendar;
import java.util.Map;
import java.util.UUID;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;

public class PayrollAuApiEmployeeTest {

Expand All @@ -56,7 +29,7 @@ public void setUp() {

// Init projectApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null);
defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null);
payrollAuApi = PayrollAuApi.getInstance(defaultClient);

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,17 @@
package com.xero.api.client;

import static org.junit.Assert.assertTrue;

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.client.*;
import com.xero.models.payrollau.*;

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.io.File;
import java.io.IOException;

import org.apache.commons.io.IOUtils;

import java.util.Calendar;
import java.util.Map;
import java.util.UUID;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;

public class PayrollAuApiLeaveApplicationTest {

Expand All @@ -56,7 +29,7 @@ public void setUp() {

// Init projectApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null);
defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null);
payrollAuApi = PayrollAuApi.getInstance(defaultClient);

}
Expand Down Expand Up @@ -102,7 +75,7 @@ public void getLeaveApplicationTest() throws IOException {
assertThat(response.getLeaveApplications().get(0).getEndDateAsDate(), is(equalTo(LocalDate.of(2019,11,12))));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodStartDateAsDate() , is(equalTo(LocalDate.of(2019,11,8))));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodEndDateAsDate() , is(equalTo(LocalDate.of(2019,11,14))));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(0.0)));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(7.6)));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getLeavePeriodStatus(), is(equalTo(com.xero.models.payrollau.LeavePeriodStatus.SCHEDULED)));
assertThat(response.getLeaveApplications().get(0).getUpdatedDateUTCAsDate(), is(equalTo(OffsetDateTime.parse("2019-11-13T05:30:08Z"))));
//System.out.println(response.toString());
Expand All @@ -123,7 +96,7 @@ public void createLeaveApplicationTest() throws IOException {
assertThat(response.getLeaveApplications().get(0).getEndDateAsDate(), is(equalTo(LocalDate.of(2019,11,01))));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodStartDateAsDate() , is(equalTo(LocalDate.of(2019,11,1))));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodEndDateAsDate() , is(equalTo(LocalDate.of(2019,11,07))));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(0.6)));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(7.6)));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getLeavePeriodStatus(), is(equalTo(com.xero.models.payrollau.LeavePeriodStatus.SCHEDULED)));
assertThat(response.getLeaveApplications().get(0).getUpdatedDateUTCAsDate(), is(equalTo(OffsetDateTime.parse("2019-11-13T21:16:31.897Z"))));
//System.out.println(response.toString());
Expand All @@ -146,7 +119,7 @@ public void updateLeaveApplicationTest() throws IOException {
assertThat(response.getLeaveApplications().get(0).getDescription(), is(equalTo("My updated Description")));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodStartDateAsDate() , is(equalTo(LocalDate.of(2019,11,01))));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getPayPeriodEndDateAsDate() , is(equalTo(LocalDate.of(2019,11,07))));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(0.6)));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getNumberOfUnits(), is(equalTo(7.6)));
assertThat(response.getLeaveApplications().get(0).getLeavePeriods().get(0).getLeavePeriodStatus(), is(equalTo(com.xero.models.payrollau.LeavePeriodStatus.SCHEDULED)));
assertThat(response.getLeaveApplications().get(0).getUpdatedDateUTCAsDate(), is(equalTo(OffsetDateTime.parse("2019-11-13T21:16:32.293Z"))));
//System.out.println(response.toString());
Expand Down
31 changes: 1 addition & 30 deletions src/test/java/com/xero/api/client/PayrollAuApiPayItemTest.java
Original file line number Diff line number Diff line change
@@ -1,44 +1,15 @@
package com.xero.api.client;

import static org.junit.Assert.assertTrue;

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.client.*;
import com.xero.models.payrollau.*;

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.io.File;
import java.io.IOException;

import org.apache.commons.io.IOUtils;

import java.util.Calendar;
import java.util.Map;
import java.util.UUID;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;

public class PayrollAuApiPayItemTest {

Expand All @@ -56,7 +27,7 @@ public void setUp() {

// Init projectApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null);
defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null);
payrollAuApi = PayrollAuApi.getInstance(defaultClient);

}
Expand Down
29 changes: 1 addition & 28 deletions src/test/java/com/xero/api/client/PayrollAuApiPayRunTest.java
Original file line number Diff line number Diff line change
@@ -1,44 +1,17 @@
package com.xero.api.client;

import static org.junit.Assert.assertTrue;

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.client.*;
import com.xero.models.payrollau.*;

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.io.File;
import java.io.IOException;

import org.apache.commons.io.IOUtils;

import java.util.Calendar;
import java.util.Map;
import java.util.UUID;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;

public class PayrollAuApiPayRunTest {

Expand All @@ -56,7 +29,7 @@ public void setUp() {

// Init projectApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null);
defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null);
payrollAuApi = PayrollAuApi.getInstance(defaultClient);

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,17 @@
package com.xero.api.client;

import static org.junit.Assert.assertTrue;

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.client.*;
import com.xero.models.payrollau.*;

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.io.File;
import java.io.IOException;

import org.apache.commons.io.IOUtils;

import java.util.Calendar;
import java.util.Map;
import java.util.UUID;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;

public class PayrollAuApiPayrollCalendarTest {

Expand All @@ -56,7 +29,7 @@ public void setUp() {

// Init projectApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null);
defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null);
payrollAuApi = PayrollAuApi.getInstance(defaultClient);

}
Expand Down
29 changes: 1 addition & 28 deletions src/test/java/com/xero/api/client/PayrollAuApiPayslipTest.java
Original file line number Diff line number Diff line change
@@ -1,44 +1,17 @@
package com.xero.api.client;

import static org.junit.Assert.assertTrue;

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.client.*;
import com.xero.models.payrollau.*;

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.io.File;
import java.io.IOException;

import org.apache.commons.io.IOUtils;

import java.util.Calendar;
import java.util.Map;
import java.util.UUID;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;

public class PayrollAuApiPayslipTest {

Expand All @@ -56,7 +29,7 @@ public void setUp() {

// Init projectApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("https://5f9f95f1-25c8-40dd-8b10-8192c658dd79.mock.pstmn.io/payroll.xro/1.0",null,null,null,null);
defaultClient = new ApiClient("http://127.0.0.1:4017",null,null,null,null);
payrollAuApi = PayrollAuApi.getInstance(defaultClient);

}
Expand Down
Loading

0 comments on commit 5119b37

Please sign in to comment.