Source Code Cross Referenced for CashReceiptServiceTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » financial » service » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » org.kuali.module.financial.service 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006-2007 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         * http://www.opensource.org/licenses/ecl1.php
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.kuali.module.financial.service;
017:
018:        import static org.kuali.test.fixtures.UserNameFixture.KHUNTLEY;
019:
020:        import java.util.Iterator;
021:        import java.util.List;
022:
023:        import org.kuali.core.exceptions.ValidationException;
024:        import org.kuali.core.service.DocumentService;
025:        import org.kuali.core.util.GlobalVariables;
026:        import org.kuali.core.util.KualiDecimal;
027:        import org.kuali.kfs.KFSConstants;
028:        import org.kuali.kfs.context.KualiTestBase;
029:        import org.kuali.kfs.context.SpringContext;
030:        import org.kuali.kfs.service.ParameterService;
031:        import org.kuali.module.financial.document.CashReceiptDocument;
032:        import org.kuali.module.financial.util.CashReceiptFamilyTestUtil;
033:        import org.kuali.test.ConfigureContext;
034:        import org.kuali.test.fixtures.UserNameFixture;
035:
036:        import edu.iu.uis.eden.exception.WorkflowException;
037:
038:        @ConfigureContext(session=KHUNTLEY)
039:        public class CashReceiptServiceTest extends KualiTestBase {
040:            // TODO: once we stop returning default campusCode for unknown verificationUnit, need a test for unknown verificationUnit
041:            private static final String TEST_CAMPUS_CD = "KO";
042:            private static String TEST_UNIT_NAME;
043:
044:            private static final String DEFAULT_CAMPUS_CD = "BL";
045:            private static String DEFAULT_UNIT_NAME;
046:
047:            private static final String UNKNOWN_UNIT_NAME = "unknownUnit";
048:
049:            public void setUp() {
050:                TEST_UNIT_NAME = SpringContext.getBean(ParameterService.class)
051:                        .getParameterValue(CashReceiptDocument.class,
052:                                "VERIFICATION_UNIT_GROUP_PREFIX")
053:                        + TEST_CAMPUS_CD;
054:                DEFAULT_UNIT_NAME = SpringContext.getBean(
055:                        ParameterService.class).getParameterValue(
056:                        CashReceiptDocument.class,
057:                        "VERIFICATION_UNIT_GROUP_PREFIX")
058:                        + DEFAULT_CAMPUS_CD;
059:            }
060:
061:            public final void testGetCampusCodeForCashReceiptVerificationUnit_blankVerificationUnit() {
062:                boolean failedAsExpected = false;
063:
064:                try {
065:                    SpringContext.getBean(CashReceiptService.class)
066:                            .getCampusCodeForCashReceiptVerificationUnit(" ");
067:                } catch (IllegalArgumentException e) {
068:                    failedAsExpected = true;
069:                }
070:
071:                assertTrue(failedAsExpected);
072:            }
073:
074:            // TODO: once we stop returning default campusCode for unknown verificationUnit, need a test for unknown verificationUnit
075:            public final void testGetCampusCodeForCashReceiptVerificationUnit_defaultVerificationUnit() {
076:                String returnedCode = SpringContext.getBean(
077:                        CashReceiptService.class)
078:                        .getCampusCodeForCashReceiptVerificationUnit(
079:                                DEFAULT_UNIT_NAME);
080:
081:                assertNotNull(returnedCode);
082:                assertEquals(DEFAULT_CAMPUS_CD, returnedCode);
083:            }
084:
085:            // TODO fix this so it doesn't use constants built into the non-test classes
086:            /*
087:             * public final void testGetCampusCodeForCashReceiptVerificationUnit_knownVerificationUnit() { String returnedCode =
088:             * SpringContext.getBean(CashReceiptService.class).getCampusCodeForCashReceiptVerificationUnit(TEST_UNIT_NAME);
089:             * assertNotNull(returnedCode); assertEquals(TEST_CAMPUS_CD, returnedCode); }
090:             */
091:
092:            public final void testGetCashReceiptVerificationUnitForCampusCode_blankCampusCode() {
093:                boolean failedAsExpected = false;
094:
095:                try {
096:                    SpringContext.getBean(CashReceiptService.class)
097:                            .getCashReceiptVerificationUnitForCampusCode(null);
098:                } catch (IllegalArgumentException e) {
099:                    failedAsExpected = true;
100:                }
101:
102:                assertTrue(failedAsExpected);
103:            }
104:
105:            // TODO: once we stop returning defaultVerificationUnit for unknown campusCode, need a test for unknown campusCode
106:            public final void testGetCashReceiptVerificationUnitForCampusCode_defaultCampusCode() {
107:                String returnedUnit = SpringContext.getBean(
108:                        CashReceiptService.class)
109:                        .getCashReceiptVerificationUnitForCampusCode(
110:                                DEFAULT_CAMPUS_CD);
111:
112:                assertNotNull(returnedUnit);
113:                assertEquals(DEFAULT_UNIT_NAME, returnedUnit);
114:            }
115:
116:            // TODO: once we stop returning default campusCode for unknown verificationUnit, need a test for unknown verificationUnit
117:            /*
118:             * public final void testGetCashReceiptVerificationUnitForCampusCode_knownCampusCode() { String returnedUnit =
119:             * SpringContext.getBean(CashReceiptService.class).getCashReceiptVerificationUnitForCampusCode(TEST_CAMPUS_CD);
120:             * assertNotNull(returnedUnit); assertEquals(TEST_UNIT_NAME, returnedUnit); }
121:             */
122:
123:            public final void testGetCashReceiptVerificationUnit_nullUser() {
124:                boolean failedAsExpected = false;
125:
126:                try {
127:                    SpringContext.getBean(CashReceiptService.class)
128:                            .getCashReceiptVerificationUnitForUser(null);
129:                } catch (IllegalArgumentException e) {
130:                    failedAsExpected = true;
131:                }
132:
133:                assertTrue(failedAsExpected);
134:            }
135:
136:            public final void testGetCashReceiptVerificationUnit_validUser() {
137:                String expectedUnit = DEFAULT_UNIT_NAME;
138:
139:                String unit = SpringContext.getBean(CashReceiptService.class)
140:                        .getCashReceiptVerificationUnitForUser(
141:                                GlobalVariables.getUserSession()
142:                                        .getUniversalUser());
143:                assertEquals(expectedUnit, unit);
144:            }
145:
146:            // TODO: once we stop returning default campus code for every user, need a test for a user who is not in a verification unit
147:
148:            public final void testGetCashReceipts1_blankUnitName() {
149:                boolean failedAsExpected = false;
150:
151:                try {
152:                    SpringContext.getBean(CashReceiptService.class)
153:                            .getCashReceipts("   ", (String) null);
154:                } catch (IllegalArgumentException e) {
155:                    failedAsExpected = true;
156:                }
157:
158:                assertTrue(failedAsExpected);
159:            }
160:
161:            public final void testGetCashReceipts1_blankStatusCode() {
162:                boolean failedAsExpected = false;
163:
164:                try {
165:                    SpringContext.getBean(CashReceiptService.class)
166:                            .getCashReceipts(TEST_UNIT_NAME, "");
167:                } catch (IllegalArgumentException e) {
168:                    failedAsExpected = true;
169:                }
170:
171:                assertTrue(failedAsExpected);
172:            }
173:
174:            // TODO: once we stop returning default campus code for unknown unit, need tests for unknown unit
175:
176:            public final void testGetCashReceipts1_knownVerificationUnit_noVerifiedReceipts() {
177:                final String workgroup = TEST_UNIT_NAME;
178:
179:                // clean up before testing
180:                denatureCashReceipts(workgroup);
181:
182:                List receipts = SpringContext
183:                        .getBean(CashReceiptService.class)
184:                        .getCashReceipts(
185:                                workgroup,
186:                                KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED);
187:                assertEquals(0, receipts.size());
188:            }
189:
190:            public final void testGetCashReceipts1_knownVerificationUnit_noInterimReceipts() {
191:                final String workgroup = TEST_UNIT_NAME;
192:
193:                // clean up before testing
194:                denatureCashReceipts(workgroup);
195:
196:                List receipts = SpringContext
197:                        .getBean(CashReceiptService.class)
198:                        .getCashReceipts(
199:                                workgroup,
200:                                KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM);
201:                assertEquals(0, receipts.size());
202:            }
203:
204:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
205:            public final void testGetCashReceipts1_knownVerificationUnit_interimReceipts()
206:                    throws Exception {
207:                final String workgroup = TEST_UNIT_NAME;
208:
209:                // clean up before testing
210:                denatureCashReceipts(workgroup);
211:
212:                // create some CRs
213:                changeCurrentUser(UserNameFixture.INEFF);
214:                CashReceiptDocument cr1 = buildCashReceiptDoc(workgroup,
215:                        "ww2 CRST cr1",
216:                        KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM,
217:                        new KualiDecimal("101.01"), new KualiDecimal("898.99"));
218:
219:                CashReceiptDocument cr2 = buildCashReceiptDoc(workgroup,
220:                        "ww2 CRST cr2",
221:                        KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM,
222:                        new KualiDecimal("212.12"), new KualiDecimal("787.87"));
223:
224:                // verify that there are only interim CRs
225:                List vreceipts = SpringContext
226:                        .getBean(CashReceiptService.class)
227:                        .getCashReceipts(
228:                                workgroup,
229:                                KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED);
230:                assertEquals(0, vreceipts.size());
231:
232:                List ireceipts = SpringContext
233:                        .getBean(CashReceiptService.class)
234:                        .getCashReceipts(
235:                                workgroup,
236:                                KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM);
237:                assertEquals(2, ireceipts.size());
238:
239:                // clean up afterwards
240:                denatureCashReceipts(workgroup);
241:            }
242:
243:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
244:            public final void testGetCashReceipts1_knownVerificationUnit_verifiedReceipts()
245:                    throws Exception {
246:                final String workgroup = TEST_UNIT_NAME;
247:
248:                // clean up before testing
249:                denatureCashReceipts(workgroup);
250:
251:                // create some CRs
252:                changeCurrentUser(UserNameFixture.INEFF);
253:                CashReceiptDocument cr1 = buildCashReceiptDoc(workgroup,
254:                        "ww2 CRST cr1",
255:                        KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED,
256:                        new KualiDecimal("101.01"), new KualiDecimal("898.99"));
257:
258:                CashReceiptDocument cr2 = buildCashReceiptDoc(workgroup,
259:                        "ww2 CRST cr2",
260:                        KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED,
261:                        new KualiDecimal("212.12"), new KualiDecimal("787.87"));
262:
263:                // verify that there are only verified CRs
264:                List ireceipts = SpringContext
265:                        .getBean(CashReceiptService.class)
266:                        .getCashReceipts(
267:                                workgroup,
268:                                KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM);
269:                assertEquals(0, ireceipts.size());
270:
271:                List vreceipts = SpringContext
272:                        .getBean(CashReceiptService.class)
273:                        .getCashReceipts(
274:                                workgroup,
275:                                KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED);
276:                assertEquals(2, vreceipts.size());
277:
278:                // clean up afterwards
279:                denatureCashReceipts(workgroup);
280:            }
281:
282:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
283:            public final void testGetCashReceipts1_knownVerificationUnit_mixedReceipts()
284:                    throws Exception {
285:                final String workgroup = TEST_UNIT_NAME;
286:
287:                // clean up before testing
288:                denatureCashReceipts(workgroup);
289:
290:                // create some CRs
291:                changeCurrentUser(UserNameFixture.INEFF);
292:                CashReceiptDocument cr1 = buildCashReceiptDoc(workgroup,
293:                        "ww2 CRST cr1",
294:                        KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM,
295:                        new KualiDecimal("101.01"), new KualiDecimal("898.99"));
296:
297:                CashReceiptDocument cr2 = buildCashReceiptDoc(workgroup,
298:                        "ww2 CRST cr2",
299:                        KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED,
300:                        new KualiDecimal("212.12"), new KualiDecimal("787.87"));
301:
302:                // verify that there are some of each
303:                List ireceipts = SpringContext
304:                        .getBean(CashReceiptService.class)
305:                        .getCashReceipts(
306:                                workgroup,
307:                                KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM);
308:                assertEquals(1, ireceipts.size());
309:
310:                List vreceipts = SpringContext
311:                        .getBean(CashReceiptService.class)
312:                        .getCashReceipts(
313:                                workgroup,
314:                                KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED);
315:                assertEquals(1, vreceipts.size());
316:
317:                // clean up afterwards
318:                denatureCashReceipts(workgroup);
319:            }
320:
321:            private static final String[] BOTH_STATII = {
322:                    KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED,
323:                    KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM };
324:            private static final String[] ISTATII = { KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM };
325:            private static final String[] VSTATII = { KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED };
326:
327:            public final void testGetCashReceipts2_blankUnitName() {
328:                boolean failedAsExpected = false;
329:
330:                try {
331:                    SpringContext.getBean(CashReceiptService.class)
332:                            .getCashReceipts("   ", (String[]) null);
333:                } catch (IllegalArgumentException e) {
334:                    failedAsExpected = true;
335:                }
336:
337:                assertTrue(failedAsExpected);
338:            }
339:
340:            public final void testGetCashReceipts2_nullStatii() {
341:                boolean failedAsExpected = false;
342:
343:                try {
344:                    SpringContext.getBean(CashReceiptService.class)
345:                            .getCashReceipts(TEST_UNIT_NAME, (String[]) null);
346:                } catch (IllegalArgumentException e) {
347:                    failedAsExpected = true;
348:                }
349:
350:                assertTrue(failedAsExpected);
351:            }
352:
353:            public final void testGetCashReceipts2_emptyStatii() {
354:                boolean failedAsExpected = false;
355:
356:                String[] emptyStatii = {};
357:                try {
358:                    SpringContext.getBean(CashReceiptService.class)
359:                            .getCashReceipts(TEST_UNIT_NAME, emptyStatii);
360:                } catch (IllegalArgumentException e) {
361:                    failedAsExpected = true;
362:                }
363:
364:                assertTrue(failedAsExpected);
365:            }
366:
367:            public final void testGetCashReceipts2_blankStatii() {
368:                boolean failedAsExpected = false;
369:
370:                String[] blankStatii = { "  " };
371:                try {
372:                    SpringContext.getBean(CashReceiptService.class)
373:                            .getCashReceipts(TEST_UNIT_NAME, blankStatii);
374:                } catch (IllegalArgumentException e) {
375:                    failedAsExpected = true;
376:                }
377:
378:                assertTrue(failedAsExpected);
379:            }
380:
381:            // TODO: once we stop returning default campus code for unknown unit, need tests for unknown unit
382:
383:            public final void testGetCashReceipts2_knownVerificationUnit_noVerifiedReceipts() {
384:                final String workgroup = TEST_UNIT_NAME;
385:
386:                // clean up before testing
387:                denatureCashReceipts(workgroup);
388:
389:                List receipts = SpringContext.getBean(CashReceiptService.class)
390:                        .getCashReceipts(workgroup, VSTATII);
391:                assertEquals(0, receipts.size());
392:            }
393:
394:            public final void testGetCashReceipts2_knownVerificationUnit_noInterimReceipts() {
395:                final String workgroup = TEST_UNIT_NAME;
396:
397:                // clean up before testing
398:                denatureCashReceipts(workgroup);
399:
400:                List receipts = SpringContext.getBean(CashReceiptService.class)
401:                        .getCashReceipts(workgroup, ISTATII);
402:                assertEquals(0, receipts.size());
403:            }
404:
405:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
406:            public final void testGetCashReceipts2_knownVerificationUnit_interimReceipts()
407:                    throws Exception {
408:                final String workgroup = TEST_UNIT_NAME;
409:
410:                // clean up before testing
411:                denatureCashReceipts(workgroup);
412:
413:                // create some CRs
414:                changeCurrentUser(UserNameFixture.INEFF);
415:                CashReceiptDocument cr1 = buildCashReceiptDoc(workgroup,
416:                        "ww2 CRST cr1",
417:                        KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM,
418:                        new KualiDecimal("101.01"), new KualiDecimal("898.99"));
419:
420:                CashReceiptDocument cr2 = buildCashReceiptDoc(workgroup,
421:                        "ww2 CRST cr2",
422:                        KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM,
423:                        new KualiDecimal("212.12"), new KualiDecimal("787.87"));
424:
425:                // verify that there are only interim CRs
426:                List vreceipts = SpringContext
427:                        .getBean(CashReceiptService.class).getCashReceipts(
428:                                workgroup, VSTATII);
429:                assertEquals(0, vreceipts.size());
430:
431:                List ireceipts = SpringContext
432:                        .getBean(CashReceiptService.class).getCashReceipts(
433:                                workgroup, ISTATII);
434:                assertEquals(2, ireceipts.size());
435:
436:                // clean up afterwards
437:                denatureCashReceipts(workgroup);
438:            }
439:
440:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
441:            public final void testGetCashReceipts2_knownVerificationUnit_verifiedReceipts()
442:                    throws Exception {
443:                final String workgroup = TEST_UNIT_NAME;
444:
445:                // clean up before testing
446:                denatureCashReceipts(workgroup);
447:
448:                // create some CRs
449:                changeCurrentUser(UserNameFixture.INEFF);
450:                CashReceiptDocument cr1 = buildCashReceiptDoc(workgroup,
451:                        "ww2 CRST cr1",
452:                        KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED,
453:                        new KualiDecimal("101.01"), new KualiDecimal("898.99"));
454:
455:                CashReceiptDocument cr2 = buildCashReceiptDoc(workgroup,
456:                        "ww2 CRST cr2",
457:                        KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED,
458:                        new KualiDecimal("212.12"), new KualiDecimal("787.87"));
459:
460:                // verify that there are only verified CRs
461:                List ireceipts = SpringContext
462:                        .getBean(CashReceiptService.class).getCashReceipts(
463:                                workgroup, ISTATII);
464:                assertEquals(0, ireceipts.size());
465:
466:                List vreceipts = SpringContext
467:                        .getBean(CashReceiptService.class).getCashReceipts(
468:                                workgroup, VSTATII);
469:                assertEquals(2, vreceipts.size());
470:
471:                // clean up afterwards
472:                denatureCashReceipts(workgroup);
473:            }
474:
475:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
476:            public final void testGetCashReceipts2_knownVerificationUnit_mixedReceipts()
477:                    throws Exception {
478:                final String workgroup = TEST_UNIT_NAME;
479:
480:                // clean up before testing
481:                denatureCashReceipts(workgroup);
482:
483:                // create some CRs
484:                changeCurrentUser(UserNameFixture.INEFF);
485:                CashReceiptDocument cr1 = buildCashReceiptDoc(workgroup,
486:                        "ww2 CRST cr1",
487:                        KFSConstants.DocumentStatusCodes.CashReceipt.INTERIM,
488:                        new KualiDecimal("101.01"), new KualiDecimal("898.99"));
489:
490:                CashReceiptDocument cr2 = buildCashReceiptDoc(workgroup,
491:                        "ww2 CRST cr2",
492:                        KFSConstants.DocumentStatusCodes.CashReceipt.VERIFIED,
493:                        new KualiDecimal("212.12"), new KualiDecimal("787.87"));
494:
495:                // verify that there are some of each
496:                List ireceipts = SpringContext
497:                        .getBean(CashReceiptService.class).getCashReceipts(
498:                                workgroup, ISTATII);
499:                assertEquals(1, ireceipts.size());
500:
501:                List vreceipts = SpringContext
502:                        .getBean(CashReceiptService.class).getCashReceipts(
503:                                workgroup, VSTATII);
504:                assertEquals(1, vreceipts.size());
505:
506:                List mixedReceipts = SpringContext.getBean(
507:                        CashReceiptService.class).getCashReceipts(workgroup,
508:                        BOTH_STATII);
509:                assertEquals(2, mixedReceipts.size());
510:
511:                // clean up afterwards
512:                denatureCashReceipts(workgroup);
513:            }
514:
515:            private void denatureCashReceipts(String workgroupName) {
516:                List verifiedReceipts = SpringContext.getBean(
517:                        CashReceiptService.class).getCashReceipts(
518:                        workgroupName, BOTH_STATII);
519:
520:                for (Iterator i = verifiedReceipts.iterator(); i.hasNext();) {
521:                    CashReceiptDocument receipt = (CashReceiptDocument) i
522:                            .next();
523:                    receipt.getDocumentHeader().setFinancialDocumentStatusCode(
524:                            "Z");
525:                    SpringContext.getBean(DocumentService.class)
526:                            .updateDocument(receipt);
527:                }
528:            }
529:
530:            private CashReceiptDocument buildCashReceiptDoc(
531:                    String workgroupName, String description, String status,
532:                    KualiDecimal cashAmount, KualiDecimal checkAmount)
533:                    throws WorkflowException {
534:                CashReceiptDocument crDoc = (CashReceiptDocument) SpringContext
535:                        .getBean(DocumentService.class).getNewDocument(
536:                                CashReceiptDocument.class);
537:
538:                crDoc.getDocumentHeader().setFinancialDocumentDescription(
539:                        description);
540:                crDoc.getDocumentHeader()
541:                        .setFinancialDocumentStatusCode(status);
542:
543:                crDoc.setCheckEntryMode(CashReceiptDocument.CHECK_ENTRY_TOTAL);
544:                crDoc.setTotalCashAmount(cashAmount);
545:                crDoc.setTotalCheckAmount(checkAmount);
546:
547:                crDoc.setCampusLocationCode(SpringContext.getBean(
548:                        CashReceiptService.class)
549:                        .getCampusCodeForCashReceiptVerificationUnit(
550:                                workgroupName));
551:
552:                crDoc.addSourceAccountingLine(CashReceiptFamilyTestUtil
553:                        .buildSourceAccountingLine(crDoc.getDocumentNumber(),
554:                                crDoc.getPostingYear(), crDoc
555:                                        .getNextSourceLineNumber()));
556:
557:                try {
558:                    SpringContext.getBean(DocumentService.class).saveDocument(
559:                            crDoc);
560:                } catch (ValidationException e) {
561:                    // If the business rule evaluation fails then give us more info for debugging this test.
562:                    fail(e.getMessage() + ", " + GlobalVariables.getErrorMap());
563:                }
564:                return crDoc;
565:            }
566:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.