Skip to content

Commit 1e84602

Browse files
authored
Merge pull request #102 from guptaatit94/develop
Adding unit tests for ReportService and ReportName
2 parents 8b1a981 + 02f78e0 commit 1e84602

File tree

3 files changed

+254
-0
lines changed

3 files changed

+254
-0
lines changed

ipp-v3-java-devkit/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
<artifactId>maven-surefire-plugin</artifactId>
145145
<version>3.0.0-M3</version>
146146
<configuration>
147+
<argLine>${argLine} -Djdk.attach.allowAttachSelf</argLine>
147148
<suiteXmlFiles>
148149
<suiteXmlFile>testng-devkit.xml</suiteXmlFile>
149150
</suiteXmlFiles>
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2017 Intuit
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
package com.intuit.ipp.services;
17+
18+
import org.testng.annotations.Test;
19+
import static org.testng.Assert.assertEquals;
20+
21+
public class ReportNameTest {
22+
23+
private ReportName reportName;
24+
25+
26+
27+
@Test
28+
public void testProfitAndLoss() {
29+
reportName = ReportName.PROFITANDLOSS;
30+
assertEquals(reportName.toString(), "ProfitAndLoss");
31+
}
32+
33+
@Test
34+
public void testBalanceSheet() {
35+
reportName = ReportName.BALANCESHEET;
36+
assertEquals(reportName.toString(), "BalanceSheet");
37+
}
38+
39+
@Test
40+
public void testCashFlow() {
41+
reportName = ReportName.CASHFLOW;
42+
assertEquals(reportName.toString(), "CashFlow");
43+
}
44+
45+
@Test
46+
public void testCustomerIncome() {
47+
reportName = ReportName.CUSTOMERINCOME;
48+
assertEquals(reportName.toString(), "CustomerIncome");
49+
}
50+
51+
@Test
52+
public void testAgedReceivables() {
53+
reportName = ReportName.AGEDRECEIVABLES;
54+
assertEquals(reportName.toString(), "AgedReceivables");
55+
}
56+
57+
@Test
58+
public void testAgedPayables() {
59+
reportName = ReportName.AGEDPAYABLES;
60+
assertEquals(reportName.toString(), "AgedPayables");
61+
}
62+
63+
@Test
64+
public void testItemSales() {
65+
reportName = ReportName.ITEMSALES;
66+
assertEquals(reportName.toString(), "ItemSales");
67+
}
68+
69+
@Test
70+
public void testDepartmentSales() {
71+
reportName = ReportName.DEPARTMENTSALES;
72+
assertEquals(reportName.toString(), "DepartmentSales");
73+
}
74+
75+
@Test
76+
public void testClassSales() {
77+
reportName = ReportName.CLASSSALES;
78+
assertEquals(reportName.toString(), "ClassSales");
79+
}
80+
81+
@Test
82+
public void testTrialBalance() {
83+
reportName = ReportName.TRIALBALANCE;
84+
assertEquals(reportName.toString(), "TrialBalance");
85+
}
86+
87+
@Test
88+
public void testTrialBalanceFR() {
89+
reportName = ReportName.TRIALBALANCE_FR;
90+
assertEquals(reportName.toString(), "TrialBalanceFR");
91+
}
92+
93+
@Test
94+
public void testVendorBalance() {
95+
reportName = ReportName.VENDORBALANCE;
96+
assertEquals(reportName.toString(), "VendorBalance");
97+
}
98+
99+
@Test
100+
public void testVendorExpenses() {
101+
reportName = ReportName.VENDOREXPENSES;
102+
assertEquals(reportName.toString(), "VendorExpenses");
103+
}
104+
105+
@Test
106+
public void testInventoryValuationSummary() {
107+
reportName = ReportName.INVENTORYVALUATIONSUMMARY;
108+
assertEquals(reportName.toString(), "InventoryValuationSummary");
109+
}
110+
111+
@Test
112+
public void testBAS() {
113+
reportName = ReportName.BAS;
114+
assertEquals(reportName.toString(), "BAS");
115+
}
116+
117+
@Test
118+
public void testVendorBalanceDetail() {
119+
reportName = ReportName.VENDORBALANCEDETAIL;
120+
assertEquals(reportName.toString(), "VendorBalanceDetail");
121+
}
122+
123+
@Test
124+
public void testGeneralLedger() {
125+
reportName = ReportName.GENERALLEDGER;
126+
assertEquals(reportName.toString(), "GeneralLedger");
127+
}
128+
129+
@Test
130+
public void testGeneralLedgerFR() {
131+
reportName = ReportName.GENERALLEDGER_FR;
132+
assertEquals(reportName.toString(), "GeneralLedgerFR");
133+
}
134+
135+
@Test
136+
public void testAgedPayableDetail() {
137+
reportName = ReportName.AGEDPAYABLEDETAIL;
138+
assertEquals(reportName.toString(), "AgedPayableDetail");
139+
}
140+
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2017 Intuit
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
package com.intuit.ipp.services;
17+
18+
import com.intuit.ipp.core.Context;
19+
import com.intuit.ipp.exception.FMSException;
20+
import com.intuit.ipp.interceptors.IntuitInterceptorProvider;
21+
import com.intuit.ipp.interceptors.IntuitMessage;
22+
import mockit.Mock;
23+
import mockit.MockUp;
24+
import mockit.Mocked;
25+
import org.testng.annotations.BeforeClass;
26+
import org.testng.annotations.Test;
27+
28+
public class ReportServiceTest {
29+
@Mocked
30+
private Context context;
31+
32+
private ReportService reportService;
33+
34+
@BeforeClass
35+
public void setup() {
36+
reportService = new ReportService(context);
37+
reportService = getMockedIntuitMessage();
38+
}
39+
40+
@Test
41+
public void testExecuteReport() throws FMSException {
42+
MockIntuitInterceptorProvider mockIntuitInterceptorProvider
43+
= new MockIntuitInterceptorProvider();
44+
reportService.executeReport("mock");
45+
}
46+
47+
public ReportService getMockedIntuitMessage() {
48+
reportService.setReport_date("");
49+
reportService.setStart_date("");
50+
reportService.setEnd_date("");
51+
reportService.setDate_macro("");
52+
reportService.setDate_macro("");
53+
reportService.setPast_due("");
54+
reportService.setEnd_duedate("");
55+
reportService.setStart_duedate("");
56+
reportService.setDuedate_macro("");
57+
reportService.setAccounting_method("");
58+
reportService.setAccount("");
59+
reportService.setSource_account("");
60+
reportService.setSource_account_type("");
61+
reportService.setSummarize_column_by("");
62+
reportService.setAccount_type("");
63+
reportService.setCustomer("");
64+
reportService.setVendor("");
65+
reportService.setItem("");
66+
reportService.setClassid("");
67+
reportService.setAppaid("");
68+
reportService.setDepartment("");
69+
reportService.setQzurl("");
70+
reportService.setAging_period("");
71+
reportService.setAging_method("");
72+
reportService.setNum_periods("");
73+
reportService.setTerm("");
74+
reportService.setColumns("");
75+
reportService.setSort_by("");
76+
reportService.setSort_order("");
77+
reportService.setGroup_by("");
78+
reportService.setCreatedate_macro("");
79+
reportService.setEnd_createdate("");
80+
reportService.setStart_createdate("");
81+
reportService.setModdate_macro("");
82+
reportService.setEnd_moddate("");
83+
reportService.setStart_moddate("");
84+
reportService.setPayment_method("");
85+
reportService.setName("");
86+
reportService.setTransaction_type("");
87+
reportService.setCleared("");
88+
reportService.setArpaid("");
89+
reportService.setPrinted("");
90+
reportService.setBoth_amount("");
91+
reportService.setMemo("");
92+
reportService.setDoc_num("");
93+
reportService.setJournal_code("");
94+
reportService.setEmployee("");
95+
reportService.setAgency_id("");
96+
reportService.setCustom1("");
97+
reportService.setCustom2("");
98+
reportService.setCustom3("");
99+
reportService.setShipvia("");
100+
reportService.setAccount_status("");
101+
reportService.setSubcol_pct_inc("");
102+
reportService.setSubcol_pct_exp("");
103+
104+
return reportService;
105+
}
106+
private static final class MockIntuitInterceptorProvider extends MockUp<IntuitInterceptorProvider> {
107+
108+
@Mock
109+
public void executeInterceptors(final IntuitMessage intuitMessage) throws FMSException {
110+
// mocked executeInterceptors
111+
}
112+
}
113+
}

0 commit comments

Comments
 (0)