Skip to content

Commit b05fe66

Browse files
committed
Fix tests
1 parent 90133ac commit b05fe66

File tree

6 files changed

+12
-39
lines changed

6 files changed

+12
-39
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ class TryCatchExample {
654654
try {
655655
// Create contact with the same name as an existing contact will generate a validation error.
656656
Contact contact = new Contact();
657-
contact.setName("Sidney Maestre");
657+
contact.setName("Test user");
658658
Contacts createContact1 = accountingApi.createContact(accessToken, xeroTenantId, contact);
659659
Contacts createContact2 = accountingApi.createContact(accessToken, xeroTenantId, contact);
660660
} catch (XeroBadRequestException e) {

src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void testGetBatchPaymentsHistory() throws Exception {
113113
UUID batchPaymentID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9");
114114

115115
HistoryRecords hr = accountingApi.getBatchPaymentHistory(accessToken,xeroTenantId,batchPaymentID);
116-
assertThat(hr.getHistoryRecords().get(0).getUser(), is(equalTo("Sidney Maestre")));
116+
assertThat(hr.getHistoryRecords().get(0).getUser(), is(equalTo("Buzz Lightyear")));
117117
assertThat(hr.getHistoryRecords().get(0).getChanges(), is(equalTo("Approved")));
118118
//System.out.println(hr.getHistoryRecords().toString());
119119
}

src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public void testCreateBrandingThemePaymentServices() throws Exception {
124124
btPaymentService.setPaymentServiceUrl("http://www.mydomain.com/paymentservice");
125125
btPaymentService.setPayNowText("Pay Now");
126126
PaymentServices response = accountingApi.createBrandingThemePaymentServices(accessToken,xeroTenantId,brandingThemeId, btPaymentService);
127-
assertThat(response.getPaymentServices().get(0).getPaymentServiceID().toString(), is(equalTo("dede7858-14e3-4a46-bf95-4d4cc491e645")));
127+
assertThat(response.getPaymentServices().get(0).getPaymentServiceID().toString(), is(equalTo("00000000-0000-0000-0000-000000000000")));
128128
assertThat(response.getPaymentServices().get(0).getPaymentServiceName(), is(equalTo("ACME Payments")));
129129
assertThat(response.getPaymentServices().get(0).getPaymentServiceUrl(), is(equalTo("https://www.payupnow.com/")));
130130
assertThat(response.getPaymentServices().get(0).getPayNowText(), is(equalTo("Pay Now")));

src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public void getInvoicesTest() throws IOException {
232232
Boolean createdByMyApp = null;
233233
Integer unitdp = null;
234234
Boolean summaryOnly = null;
235-
Invoices response = accountingApi.getInvoices(accessToken,xeroTenantId,ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, summaryOnly, unitdp);
235+
Invoices response = accountingApi.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, order, ids, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp, summaryOnly);
236236

237237
assertThat(response.getInvoices().get(0).getType(), is(equalTo(com.xero.models.accounting.Invoice.TypeEnum.ACCREC)));
238238
assertThat(response.getInvoices().get(0).getDateAsDate(), is(equalTo(LocalDate.of(2018,10,20))));

src/test/java/com/xero/api/client/AccountingApiReportsTest.java

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ public void getReportAgedPayablesByContactTest() throws IOException {
9090

9191
ReportWithRows response = accountingApi.getReportAgedPayablesByContact(accessToken,xeroTenantId,contactId, date, fromDate, toDate);
9292

93-
assertThat(response.getReports().get(0).getReportID(), is(equalTo("AgedPayablesByContact")));
9493
assertThat(response.getReports().get(0).getReportName(), is(equalTo("Aged Payables By Contact")));
9594
assertThat(response.getReports().get(0).getReportType(), is("AgedPayablesByContact"));
9695
assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Invoices")));
@@ -127,7 +126,6 @@ public void getReportAgedReceivablesByContactTest() throws IOException {
127126
LocalDate toDate = null;
128127
ReportWithRows response = accountingApi.getReportAgedReceivablesByContact(accessToken,xeroTenantId,contactId, date, fromDate, toDate);
129128

130-
assertThat(response.getReports().get(0).getReportID(), is(equalTo("AgedReceivablesByContact")));
131129
assertThat(response.getReports().get(0).getReportName(), is(equalTo("Aged Receivables By Contact")));
132130
assertThat(response.getReports().get(0).getReportType(), is("AgedReceivablesByContact"));
133131
assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Invoices")));
@@ -168,7 +166,6 @@ public void getReportBalanceSheetTest() throws IOException {
168166
Boolean paymentsOnly = null;
169167
ReportWithRows response = accountingApi.getReportBalanceSheet(accessToken,xeroTenantId,date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly);
170168

171-
assertThat(response.getReports().get(0).getReportID(), is(equalTo("BalanceSheet")));
172169
assertThat(response.getReports().get(0).getReportName(), is(equalTo("Balance Sheet")));
173170
assertThat(response.getReports().get(0).getReportType(), is(equalTo("BalanceSheet")));
174171
assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Balance Sheet")));
@@ -194,7 +191,6 @@ public void getReportBankSummaryTest() throws IOException {
194191
LocalDate fromDate = null;
195192

196193
ReportWithRows response = accountingApi.getReportBankSummary(accessToken,xeroTenantId,fromDate, toDate );
197-
assertThat(response.getReports().get(0).getReportID(), is(equalTo("BankSummary")));
198194
assertThat(response.getReports().get(0).getReportName(), is(equalTo("Bank Summary")));
199195
assertThat(response.getReports().get(0).getReportType(), is("BankSummary"));
200196
assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Bank Summary")));
@@ -225,11 +221,10 @@ public void getReportExecutiveSummaryTest() throws IOException {
225221

226222
ReportWithRows response = accountingApi.getReportExecutiveSummary(accessToken,xeroTenantId,date);
227223

228-
assertThat(response.getReports().get(0).getReportID(), is(equalTo("ExecutiveSummary")));
229224
assertThat(response.getReports().get(0).getReportName(), is(equalTo("Executive Summary")));
230225
assertThat(response.getReports().get(0).getReportType(), is("ExecutiveSummary"));
231226
assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Executive Summary")));
232-
assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Mind Body Online Test 11")));
227+
assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Online Test 11")));
233228
assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("For the month of November 2019")));
234229
assertThat(response.getReports().get(0).getReportDate(), is(equalTo("14 November 2019")));
235230
assertThat(response.getReports().get(0).getRows().get(0).getRowType(), is(equalTo(com.xero.models.accounting.RowType.HEADER)));
@@ -283,7 +278,6 @@ public void getReportTrialBalanceTest() throws IOException {
283278
Boolean paymentsOnly = null;
284279
ReportWithRows response = accountingApi.getReportTrialBalance(accessToken,xeroTenantId,date, paymentsOnly);
285280

286-
assertThat(response.getReports().get(0).getReportID(), is(equalTo("TrialBalance")));
287281
assertThat(response.getReports().get(0).getReportName(), is(equalTo("Trial Balance")));
288282
assertThat(response.getReports().get(0).getReportType(), is("TrialBalance"));
289283
assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Trial Balance")));
@@ -313,12 +307,11 @@ public void getReportBudgetSummaryTest() throws IOException {
313307
Integer timeframe = null;
314308
ReportWithRows response = accountingApi.getReportBudgetSummary(accessToken,xeroTenantId,date, period, timeframe);
315309

316-
assertThat(response.getReports().get(0).getReportID(), is(equalTo("BudgetSummary")));
317310
assertThat(response.getReports().get(0).getReportName(), is(equalTo("Budget Summary")));
318311
assertThat(response.getReports().get(0).getReportType(), is("BudgetSummary"));
319312
assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Overall Budget")));
320313
assertThat(response.getReports().get(0).getReportTitles().get(1), is(equalTo("Budget Summary")));
321-
assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("Mind Body Online Test 11")));
314+
assertThat(response.getReports().get(0).getReportTitles().get(2), is(equalTo("Online Test 11")));
322315
assertThat(response.getReports().get(0).getReportTitles().get(3), is(equalTo("November 2019 to October 2022")));
323316
assertThat(response.getReports().get(0).getReportDate(), is(equalTo("14 November 2019")));
324317
assertThat(response.getReports().get(0).getUpdatedDateUTCAsDate(), is(equalTo(OffsetDateTime.parse("2019-11-14T18:10:37.865Z"))));
@@ -356,7 +349,6 @@ public void getReportProfitAndLossTest() throws IOException {
356349

357350
ReportWithRows response = accountingApi.getReportProfitAndLoss(accessToken,xeroTenantId,fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly);
358351

359-
// assertThat(response.getReports().get(0).getReportID(), is(equalTo("ProfitAndLoss")));
360352
// assertThat(response.getReports().get(0).getReportName(), is(equalTo("Profit and Loss")));
361353
// assertThat(response.getReports().get(0).getReportType(), is("ProfitAndLoss"));
362354
// assertThat(response.getReports().get(0).getReportTitles().get(0), is(equalTo("Income Statement")));
@@ -377,23 +369,4 @@ public void getReportProfitAndLossTest() throws IOException {
377369

378370
//System.out.println(response.toString());
379371
}
380-
381-
@Test
382-
public void getReportBASorGSTTest() throws IOException {
383-
System.out.println("@Test - getReportBASorGST - not implemented");
384-
String reportID = null;
385-
//ReportWithRows response = accountingApi.getReportBASorGST(reportID);
386-
387-
// TODO: test validations
388-
//System.out.println(response.getReports().get(0).toString());
389-
}
390-
391-
@Test
392-
public void getReportBASorGSTListTest() throws IOException {
393-
System.out.println("@Test - getReportBASorGSTList - not implemented");
394-
//ReportWithRows response = accountingApi.getReportBASorGSTList();
395-
396-
// TODO: test validations
397-
//System.out.println(response.getReports().get(0).toString());
398-
}
399372
}

src/test/java/com/xero/api/client/AccountingApiUsersTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public void getUserTest() throws IOException {
8787
Users response = accountingApi.getUser(accessToken,xeroTenantId,userID);
8888

8989
assertThat(response.getUsers().get(0).getUserID(), is(equalTo(UUID.fromString("3c37ef1d-cd49-4589-9787-3c418ed8b6ac"))));
90-
assertThat(response.getUsers().get(0).getEmailAddress(), is(equalTo("sid.maestre@xero.com")));
91-
assertThat(response.getUsers().get(0).getFirstName(), is(equalTo("Sidney")));
92-
assertThat(response.getUsers().get(0).getLastName(), is(equalTo("Maestre")));
90+
assertThat(response.getUsers().get(0).getEmailAddress(), is(equalTo("test@email.com")));
91+
assertThat(response.getUsers().get(0).getFirstName(), is(equalTo("Test")));
92+
assertThat(response.getUsers().get(0).getLastName(), is(equalTo("Xero")));
9393
assertThat(response.getUsers().get(0).getUpdatedDateUTCAsDate(), is(equalTo(OffsetDateTime.parse("2017-10-20T18:14:21.613Z"))));
9494
assertThat(response.getUsers().get(0).getIsSubscriber(), is(equalTo(false)));
9595
assertThat(response.getUsers().get(0).getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER)));
@@ -105,9 +105,9 @@ public void getUsersTest() throws IOException {
105105
Users response = accountingApi.getUsers(accessToken,xeroTenantId,ifModifiedSince, where, order);
106106

107107
assertThat(response.getUsers().get(0).getUserID(), is(equalTo(UUID.fromString("3c37ef1d-cd49-4589-9787-3c418ed8b6ac"))));
108-
assertThat(response.getUsers().get(0).getEmailAddress(), is(equalTo("sid.maestre@xero.com")));
109-
assertThat(response.getUsers().get(0).getFirstName(), is(equalTo("Sidney")));
110-
assertThat(response.getUsers().get(0).getLastName(), is(equalTo("Maestre")));
108+
assertThat(response.getUsers().get(0).getEmailAddress(), is(equalTo("test@email.com")));
109+
assertThat(response.getUsers().get(0).getFirstName(), is(equalTo("Test")));
110+
assertThat(response.getUsers().get(0).getLastName(), is(equalTo("Xero")));
111111
assertThat(response.getUsers().get(0).getUpdatedDateUTCAsDate(), is(equalTo(OffsetDateTime.parse("2017-10-20T18:14:21.613Z"))));
112112
assertThat(response.getUsers().get(0).getIsSubscriber(), is(equalTo(false)));
113113
assertThat(response.getUsers().get(0).getOrganisationRole(), is(equalTo(com.xero.models.accounting.User.OrganisationRoleEnum.FINANCIALADVISER)));

0 commit comments

Comments
 (0)