Source Code Cross Referenced for GeneralErrorCorrectionDocumentRuleTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » financial » rules » 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.rules 
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.rules;
017:
018:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testAddAccountingLineRule_IsObjectCodeAllowed;
019:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testAddAccountingLineRule_IsObjectTypeAllowed;
020:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testAddAccountingLineRule_ProcessAddAccountingLineBusinessRules;
021:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testAddAccountingLine_IsObjectSubTypeAllowed;
022:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testGenerateGeneralLedgerPendingEntriesRule_ProcessGenerateGeneralLedgerPendingEntries;
023:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testRouteDocumentRule_processRouteDocument;
024:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testSaveDocumentRule_ProcessSaveDocument;
025:        import static org.kuali.module.financial.rules.IsDebitTestUtils.Amount.NEGATIVE;
026:        import static org.kuali.module.financial.rules.IsDebitTestUtils.Amount.POSITIVE;
027:        import static org.kuali.test.fixtures.AccountingLineFixture.ACCRUED_INCOME_LINE;
028:        import static org.kuali.test.fixtures.AccountingLineFixture.CASH_LINE;
029:        import static org.kuali.test.fixtures.AccountingLineFixture.EXPENSE_GEC_LINE;
030:        import static org.kuali.test.fixtures.AccountingLineFixture.LINE10;
031:        import static org.kuali.test.fixtures.AccountingLineFixture.LINE16;
032:        import static org.kuali.test.fixtures.AccountingLineFixture.LINE8;
033:        import static org.kuali.test.fixtures.AccountingLineFixture.LOSSS_ON_RETIRE_LINE;
034:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_GEC_EXPLICIT_SOURCE_PENDING_ENTRY;
035:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_GEC_EXPLICIT_SOURCE_PENDING_ENTRY_FOR_EXPENSE;
036:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_GEC_EXPLICIT_TARGET_PENDING_ENTRY;
037:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_GEC_EXPLICIT_TARGET_PENDING_ENTRY_FOR_EXPENSE;
038:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_GEC_OFFSET_SOURCE_PENDING_ENTRY;
039:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_GEC_OFFSET_TARGET_PENDING_ENTRY;
040:        import static org.kuali.test.fixtures.UserNameFixture.KHUNTLEY;
041:
042:        import java.util.ArrayList;
043:        import java.util.List;
044:
045:        import org.kuali.core.service.DataDictionaryService;
046:        import org.kuali.core.service.DocumentService;
047:        import org.kuali.core.service.DocumentTypeService;
048:        import org.kuali.core.util.KualiDecimal;
049:        import org.kuali.kfs.KFSConstants;
050:        import org.kuali.kfs.bo.AccountingLine;
051:        import org.kuali.kfs.bo.SourceAccountingLine;
052:        import org.kuali.kfs.bo.TargetAccountingLine;
053:        import org.kuali.kfs.context.KualiTestBase;
054:        import org.kuali.kfs.context.SpringContext;
055:        import org.kuali.kfs.document.AccountingDocument;
056:        import org.kuali.module.financial.document.GeneralErrorCorrectionDocument;
057:        import org.kuali.test.ConfigureContext;
058:        import org.kuali.test.DocumentTestUtils;
059:
060:        @ConfigureContext(session=KHUNTLEY)
061:        public class GeneralErrorCorrectionDocumentRuleTest extends
062:                KualiTestBase {
063:            public static final Class<GeneralErrorCorrectionDocument> DOCUMENT_CLASS = GeneralErrorCorrectionDocument.class;
064:
065:            public void testIsDebit_source_income_positveAmount()
066:                    throws Exception {
067:                AccountingDocument accountingDocument = IsDebitTestUtils
068:                        .getDocument(SpringContext
069:                                .getBean(DocumentService.class),
070:                                GeneralErrorCorrectionDocument.class);
071:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
072:                        accountingDocument, SourceAccountingLine.class,
073:                        POSITIVE);
074:
075:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
076:                        .getBean(DocumentTypeService.class), SpringContext
077:                        .getBean(DataDictionaryService.class),
078:                        accountingDocument, accountingLine));
079:            }
080:
081:            public void testIsDebit_source_income_negativeAmount()
082:                    throws Exception {
083:                AccountingDocument accountingDocument = IsDebitTestUtils
084:                        .getDocument(SpringContext
085:                                .getBean(DocumentService.class),
086:                                GeneralErrorCorrectionDocument.class);
087:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
088:                        accountingDocument, SourceAccountingLine.class,
089:                        NEGATIVE);
090:
091:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
092:                        SpringContext.getBean(DocumentTypeService.class),
093:                        SpringContext.getBean(DataDictionaryService.class),
094:                        accountingDocument, accountingLine));
095:            }
096:
097:            public void testIsDebit_source_income_zeroAmount() throws Exception {
098:
099:                AccountingDocument accountingDocument = IsDebitTestUtils
100:                        .getDocument(SpringContext
101:                                .getBean(DocumentService.class),
102:                                GeneralErrorCorrectionDocument.class);
103:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
104:                        accountingDocument, SourceAccountingLine.class,
105:                        KualiDecimal.ZERO);
106:
107:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
108:                        SpringContext.getBean(DocumentTypeService.class),
109:                        SpringContext.getBean(DataDictionaryService.class),
110:                        accountingDocument, accountingLine));
111:            }
112:
113:            public void testIsDebit_source_expense_positveAmount()
114:                    throws Exception {
115:                AccountingDocument accountingDocument = IsDebitTestUtils
116:                        .getDocument(SpringContext
117:                                .getBean(DocumentService.class),
118:                                GeneralErrorCorrectionDocument.class);
119:                AccountingLine accountingLine = IsDebitTestUtils
120:                        .getExpenseLine(accountingDocument,
121:                                SourceAccountingLine.class, POSITIVE);
122:
123:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
124:                        .getBean(DocumentTypeService.class), SpringContext
125:                        .getBean(DataDictionaryService.class),
126:                        accountingDocument, accountingLine));
127:            }
128:
129:            public void testIsDebit_source_expense_negativeAmount()
130:                    throws Exception {
131:                AccountingDocument accountingDocument = IsDebitTestUtils
132:                        .getDocument(SpringContext
133:                                .getBean(DocumentService.class),
134:                                GeneralErrorCorrectionDocument.class);
135:                AccountingLine accountingLine = IsDebitTestUtils
136:                        .getExpenseLine(accountingDocument,
137:                                SourceAccountingLine.class, NEGATIVE);
138:
139:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
140:                        SpringContext.getBean(DocumentTypeService.class),
141:                        SpringContext.getBean(DataDictionaryService.class),
142:                        accountingDocument, accountingLine));
143:            }
144:
145:            public void testIsDebit_source_expense_zeroAmount()
146:                    throws Exception {
147:                AccountingDocument accountingDocument = IsDebitTestUtils
148:                        .getDocument(SpringContext
149:                                .getBean(DocumentService.class),
150:                                GeneralErrorCorrectionDocument.class);
151:                AccountingLine accountingLine = IsDebitTestUtils
152:                        .getExpenseLine(accountingDocument,
153:                                SourceAccountingLine.class, KualiDecimal.ZERO);
154:
155:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
156:                        SpringContext.getBean(DocumentTypeService.class),
157:                        SpringContext.getBean(DataDictionaryService.class),
158:                        accountingDocument, accountingLine));
159:            }
160:
161:            public void testIsDebit_source_asset_positveAmount()
162:                    throws Exception {
163:                AccountingDocument accountingDocument = IsDebitTestUtils
164:                        .getDocument(SpringContext
165:                                .getBean(DocumentService.class),
166:                                GeneralErrorCorrectionDocument.class);
167:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
168:                        accountingDocument, SourceAccountingLine.class,
169:                        POSITIVE);
170:
171:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
172:                        .getBean(DocumentTypeService.class), SpringContext
173:                        .getBean(DataDictionaryService.class),
174:                        accountingDocument, accountingLine));
175:            }
176:
177:            public void testIsDebit_source_asset_negativeAmount()
178:                    throws Exception {
179:                AccountingDocument accountingDocument = IsDebitTestUtils
180:                        .getDocument(SpringContext
181:                                .getBean(DocumentService.class),
182:                                GeneralErrorCorrectionDocument.class);
183:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
184:                        accountingDocument, SourceAccountingLine.class,
185:                        NEGATIVE);
186:
187:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
188:                        SpringContext.getBean(DocumentTypeService.class),
189:                        SpringContext.getBean(DataDictionaryService.class),
190:                        accountingDocument, accountingLine));
191:            }
192:
193:            public void testIsDebit_source_asset_zeroAmount() throws Exception {
194:                AccountingDocument accountingDocument = IsDebitTestUtils
195:                        .getDocument(SpringContext
196:                                .getBean(DocumentService.class),
197:                                GeneralErrorCorrectionDocument.class);
198:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
199:                        accountingDocument, SourceAccountingLine.class,
200:                        KualiDecimal.ZERO);
201:
202:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
203:                        SpringContext.getBean(DocumentTypeService.class),
204:                        SpringContext.getBean(DataDictionaryService.class),
205:                        accountingDocument, accountingLine));
206:            }
207:
208:            public void testIsDebit_source_liability_positveAmount()
209:                    throws Exception {
210:                AccountingDocument accountingDocument = IsDebitTestUtils
211:                        .getDocument(SpringContext
212:                                .getBean(DocumentService.class),
213:                                GeneralErrorCorrectionDocument.class);
214:                AccountingLine accountingLine = IsDebitTestUtils
215:                        .getLiabilityLine(accountingDocument,
216:                                SourceAccountingLine.class, POSITIVE);
217:
218:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
219:                        .getBean(DocumentTypeService.class), SpringContext
220:                        .getBean(DataDictionaryService.class),
221:                        accountingDocument, accountingLine));
222:            }
223:
224:            public void testIsDebit_source_liability_negativeAmount()
225:                    throws Exception {
226:                AccountingDocument accountingDocument = IsDebitTestUtils
227:                        .getDocument(SpringContext
228:                                .getBean(DocumentService.class),
229:                                GeneralErrorCorrectionDocument.class);
230:                AccountingLine accountingLine = IsDebitTestUtils
231:                        .getLiabilityLine(accountingDocument,
232:                                SourceAccountingLine.class, NEGATIVE);
233:
234:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
235:                        SpringContext.getBean(DocumentTypeService.class),
236:                        SpringContext.getBean(DataDictionaryService.class),
237:                        accountingDocument, accountingLine));
238:            }
239:
240:            public void testIsDebit_source_liability_zeroAmount()
241:                    throws Exception {
242:                AccountingDocument accountingDocument = IsDebitTestUtils
243:                        .getDocument(SpringContext
244:                                .getBean(DocumentService.class),
245:                                GeneralErrorCorrectionDocument.class);
246:                AccountingLine accountingLine = IsDebitTestUtils
247:                        .getLiabilityLine(accountingDocument,
248:                                SourceAccountingLine.class, KualiDecimal.ZERO);
249:
250:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
251:                        SpringContext.getBean(DocumentTypeService.class),
252:                        SpringContext.getBean(DataDictionaryService.class),
253:                        accountingDocument, accountingLine));
254:            }
255:
256:            public void testIsDebit_target_income_positveAmount()
257:                    throws Exception {
258:                AccountingDocument accountingDocument = IsDebitTestUtils
259:                        .getDocument(SpringContext
260:                                .getBean(DocumentService.class),
261:                                GeneralErrorCorrectionDocument.class);
262:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
263:                        accountingDocument, TargetAccountingLine.class,
264:                        POSITIVE);
265:
266:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
267:                        .getBean(DocumentTypeService.class), SpringContext
268:                        .getBean(DataDictionaryService.class),
269:                        accountingDocument, accountingLine));
270:            }
271:
272:            public void testIsDebit_target_income_negativeAmount()
273:                    throws Exception {
274:                AccountingDocument accountingDocument = IsDebitTestUtils
275:                        .getDocument(SpringContext
276:                                .getBean(DocumentService.class),
277:                                GeneralErrorCorrectionDocument.class);
278:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
279:                        accountingDocument, TargetAccountingLine.class,
280:                        NEGATIVE);
281:
282:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
283:                        SpringContext.getBean(DocumentTypeService.class),
284:                        SpringContext.getBean(DataDictionaryService.class),
285:                        accountingDocument, accountingLine));
286:            }
287:
288:            public void testIsDebit_target_income_zeroAmount() throws Exception {
289:
290:                AccountingDocument accountingDocument = IsDebitTestUtils
291:                        .getDocument(SpringContext
292:                                .getBean(DocumentService.class),
293:                                GeneralErrorCorrectionDocument.class);
294:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
295:                        accountingDocument, TargetAccountingLine.class,
296:                        KualiDecimal.ZERO);
297:
298:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
299:                        SpringContext.getBean(DocumentTypeService.class),
300:                        SpringContext.getBean(DataDictionaryService.class),
301:                        accountingDocument, accountingLine));
302:            }
303:
304:            public void testIsDebit_target_expense_positveAmount()
305:                    throws Exception {
306:                AccountingDocument accountingDocument = IsDebitTestUtils
307:                        .getDocument(SpringContext
308:                                .getBean(DocumentService.class),
309:                                GeneralErrorCorrectionDocument.class);
310:                AccountingLine accountingLine = IsDebitTestUtils
311:                        .getExpenseLine(accountingDocument,
312:                                TargetAccountingLine.class, POSITIVE);
313:
314:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
315:                        .getBean(DocumentTypeService.class), SpringContext
316:                        .getBean(DataDictionaryService.class),
317:                        accountingDocument, accountingLine));
318:            }
319:
320:            public void testIsDebit_target_expense_negativeAmount()
321:                    throws Exception {
322:                AccountingDocument accountingDocument = IsDebitTestUtils
323:                        .getDocument(SpringContext
324:                                .getBean(DocumentService.class),
325:                                GeneralErrorCorrectionDocument.class);
326:                AccountingLine accountingLine = IsDebitTestUtils
327:                        .getExpenseLine(accountingDocument,
328:                                TargetAccountingLine.class, NEGATIVE);
329:
330:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
331:                        SpringContext.getBean(DocumentTypeService.class),
332:                        SpringContext.getBean(DataDictionaryService.class),
333:                        accountingDocument, accountingLine));
334:            }
335:
336:            public void testIsDebit_target_expense_zeroAmount()
337:                    throws Exception {
338:                AccountingDocument accountingDocument = IsDebitTestUtils
339:                        .getDocument(SpringContext
340:                                .getBean(DocumentService.class),
341:                                GeneralErrorCorrectionDocument.class);
342:                AccountingLine accountingLine = IsDebitTestUtils
343:                        .getExpenseLine(accountingDocument,
344:                                TargetAccountingLine.class, KualiDecimal.ZERO);
345:
346:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
347:                        SpringContext.getBean(DocumentTypeService.class),
348:                        SpringContext.getBean(DataDictionaryService.class),
349:                        accountingDocument, accountingLine));
350:            }
351:
352:            public void testIsDebit_target_asset_positveAmount()
353:                    throws Exception {
354:                AccountingDocument accountingDocument = IsDebitTestUtils
355:                        .getDocument(SpringContext
356:                                .getBean(DocumentService.class),
357:                                GeneralErrorCorrectionDocument.class);
358:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
359:                        accountingDocument, TargetAccountingLine.class,
360:                        POSITIVE);
361:
362:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
363:                        .getBean(DocumentTypeService.class), SpringContext
364:                        .getBean(DataDictionaryService.class),
365:                        accountingDocument, accountingLine));
366:            }
367:
368:            public void testIsDebit_target_asset_negativeAmount()
369:                    throws Exception {
370:                AccountingDocument accountingDocument = IsDebitTestUtils
371:                        .getDocument(SpringContext
372:                                .getBean(DocumentService.class),
373:                                GeneralErrorCorrectionDocument.class);
374:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
375:                        accountingDocument, TargetAccountingLine.class,
376:                        NEGATIVE);
377:
378:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
379:                        SpringContext.getBean(DocumentTypeService.class),
380:                        SpringContext.getBean(DataDictionaryService.class),
381:                        accountingDocument, accountingLine));
382:            }
383:
384:            public void testIsDebit_target_asset_zeroAmount() throws Exception {
385:                AccountingDocument accountingDocument = IsDebitTestUtils
386:                        .getDocument(SpringContext
387:                                .getBean(DocumentService.class),
388:                                GeneralErrorCorrectionDocument.class);
389:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
390:                        accountingDocument, TargetAccountingLine.class,
391:                        KualiDecimal.ZERO);
392:
393:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
394:                        SpringContext.getBean(DocumentTypeService.class),
395:                        SpringContext.getBean(DataDictionaryService.class),
396:                        accountingDocument, accountingLine));
397:            }
398:
399:            public void testIsDebit_target_liability_positveAmount()
400:                    throws Exception {
401:                AccountingDocument accountingDocument = IsDebitTestUtils
402:                        .getDocument(SpringContext
403:                                .getBean(DocumentService.class),
404:                                GeneralErrorCorrectionDocument.class);
405:                AccountingLine accountingLine = IsDebitTestUtils
406:                        .getLiabilityLine(accountingDocument,
407:                                TargetAccountingLine.class, POSITIVE);
408:
409:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
410:                        .getBean(DocumentTypeService.class), SpringContext
411:                        .getBean(DataDictionaryService.class),
412:                        accountingDocument, accountingLine));
413:            }
414:
415:            public void testIsDebit_target_liability_negativeAmount()
416:                    throws Exception {
417:                AccountingDocument accountingDocument = IsDebitTestUtils
418:                        .getDocument(SpringContext
419:                                .getBean(DocumentService.class),
420:                                GeneralErrorCorrectionDocument.class);
421:                AccountingLine accountingLine = IsDebitTestUtils
422:                        .getLiabilityLine(accountingDocument,
423:                                TargetAccountingLine.class, NEGATIVE);
424:
425:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
426:                        SpringContext.getBean(DocumentTypeService.class),
427:                        SpringContext.getBean(DataDictionaryService.class),
428:                        accountingDocument, accountingLine));
429:            }
430:
431:            public void testIsDebit_target_liability_zeroAmount()
432:                    throws Exception {
433:                AccountingDocument accountingDocument = IsDebitTestUtils
434:                        .getDocument(SpringContext
435:                                .getBean(DocumentService.class),
436:                                GeneralErrorCorrectionDocument.class);
437:                AccountingLine accountingLine = IsDebitTestUtils
438:                        .getLiabilityLine(accountingDocument,
439:                                TargetAccountingLine.class, KualiDecimal.ZERO);
440:
441:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
442:                        SpringContext.getBean(DocumentTypeService.class),
443:                        SpringContext.getBean(DataDictionaryService.class),
444:                        accountingDocument, accountingLine));
445:            }
446:
447:            public void testIsDebit_errorCorrection_source_income_negativeAmount()
448:                    throws Exception {
449:                AccountingDocument accountingDocument = IsDebitTestUtils
450:                        .getErrorCorrectionDocument(SpringContext
451:                                .getBean(DocumentService.class),
452:                                GeneralErrorCorrectionDocument.class);
453:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
454:                        accountingDocument, SourceAccountingLine.class,
455:                        NEGATIVE);
456:
457:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
458:                        .getBean(DocumentTypeService.class), SpringContext
459:                        .getBean(DataDictionaryService.class),
460:                        accountingDocument, accountingLine));
461:            }
462:
463:            public void testIsDebit_errorCorrection_source_expense_negativeAmount()
464:                    throws Exception {
465:                AccountingDocument accountingDocument = IsDebitTestUtils
466:                        .getErrorCorrectionDocument(SpringContext
467:                                .getBean(DocumentService.class),
468:                                GeneralErrorCorrectionDocument.class);
469:                AccountingLine accountingLine = IsDebitTestUtils
470:                        .getExpenseLine(accountingDocument,
471:                                SourceAccountingLine.class, NEGATIVE);
472:
473:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
474:                        .getBean(DocumentTypeService.class), SpringContext
475:                        .getBean(DataDictionaryService.class),
476:                        accountingDocument, accountingLine));
477:            }
478:
479:            public void testIsDebit_errorCorrection_source_asset_negativeAmount()
480:                    throws Exception {
481:                AccountingDocument accountingDocument = IsDebitTestUtils
482:                        .getErrorCorrectionDocument(SpringContext
483:                                .getBean(DocumentService.class),
484:                                GeneralErrorCorrectionDocument.class);
485:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
486:                        accountingDocument, SourceAccountingLine.class,
487:                        NEGATIVE);
488:
489:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
490:                        .getBean(DocumentTypeService.class), SpringContext
491:                        .getBean(DataDictionaryService.class),
492:                        accountingDocument, accountingLine));
493:            }
494:
495:            public void testIsDebit_errorCorrection_source_liability_negativeAmount()
496:                    throws Exception {
497:                AccountingDocument accountingDocument = IsDebitTestUtils
498:                        .getErrorCorrectionDocument(SpringContext
499:                                .getBean(DocumentService.class),
500:                                GeneralErrorCorrectionDocument.class);
501:                AccountingLine accountingLine = IsDebitTestUtils
502:                        .getLiabilityLine(accountingDocument,
503:                                SourceAccountingLine.class, NEGATIVE);
504:
505:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
506:                        .getBean(DocumentTypeService.class), SpringContext
507:                        .getBean(DataDictionaryService.class),
508:                        accountingDocument, accountingLine));
509:            }
510:
511:            public void testIsDebit_errorCorrection_target_income_negativeAmount()
512:                    throws Exception {
513:                AccountingDocument accountingDocument = IsDebitTestUtils
514:                        .getErrorCorrectionDocument(SpringContext
515:                                .getBean(DocumentService.class),
516:                                GeneralErrorCorrectionDocument.class);
517:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
518:                        accountingDocument, TargetAccountingLine.class,
519:                        NEGATIVE);
520:
521:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
522:                        .getBean(DocumentTypeService.class), SpringContext
523:                        .getBean(DataDictionaryService.class),
524:                        accountingDocument, accountingLine));
525:            }
526:
527:            public void testIsDebit_errorCorrection_target_expense_negativeAmount()
528:                    throws Exception {
529:                AccountingDocument accountingDocument = IsDebitTestUtils
530:                        .getErrorCorrectionDocument(SpringContext
531:                                .getBean(DocumentService.class),
532:                                GeneralErrorCorrectionDocument.class);
533:                AccountingLine accountingLine = IsDebitTestUtils
534:                        .getExpenseLine(accountingDocument,
535:                                TargetAccountingLine.class, NEGATIVE);
536:
537:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
538:                        .getBean(DocumentTypeService.class), SpringContext
539:                        .getBean(DataDictionaryService.class),
540:                        accountingDocument, accountingLine));
541:            }
542:
543:            public void testIsDebit_errorCorrection_target_asset_negativeAmount()
544:                    throws Exception {
545:                AccountingDocument accountingDocument = IsDebitTestUtils
546:                        .getErrorCorrectionDocument(SpringContext
547:                                .getBean(DocumentService.class),
548:                                GeneralErrorCorrectionDocument.class);
549:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
550:                        accountingDocument, TargetAccountingLine.class,
551:                        NEGATIVE);
552:
553:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
554:                        .getBean(DocumentTypeService.class), SpringContext
555:                        .getBean(DataDictionaryService.class),
556:                        accountingDocument, accountingLine));
557:            }
558:
559:            public void testIsDebit_errorCorrection_target_liability_negativeAmount()
560:                    throws Exception {
561:                AccountingDocument accountingDocument = IsDebitTestUtils
562:                        .getErrorCorrectionDocument(SpringContext
563:                                .getBean(DocumentService.class),
564:                                GeneralErrorCorrectionDocument.class);
565:                AccountingLine accountingLine = IsDebitTestUtils
566:                        .getLiabilityLine(accountingDocument,
567:                                TargetAccountingLine.class, NEGATIVE);
568:
569:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
570:                        .getBean(DocumentTypeService.class), SpringContext
571:                        .getBean(DataDictionaryService.class),
572:                        accountingDocument, accountingLine));
573:            }
574:
575:            public void testIsObjectTypeAllowed_InvalidObjectType()
576:                    throws Exception {
577:                testAddAccountingLineRule_IsObjectTypeAllowed(DOCUMENT_CLASS,
578:                        getInvalidObjectTypeSourceLine(), false);
579:            }
580:
581:            public void testIsObjectTypeAllowed_Valid() throws Exception {
582:                testAddAccountingLineRule_IsObjectTypeAllowed(DOCUMENT_CLASS,
583:                        getValidObjectTypeSourceLine(), true);
584:            }
585:
586:            public void testIsObjectCodeAllowed_Valid() throws Exception {
587:                testAddAccountingLineRule_IsObjectCodeAllowed(DOCUMENT_CLASS,
588:                        getValidObjectCodeSourceLine(), true);
589:            }
590:
591:            public void testIsObjectCodeAllowed_InvalidObjectCode()
592:                    throws Exception {
593:                testAddAccountingLineRule_IsObjectCodeAllowed(DOCUMENT_CLASS,
594:                        getInvalidObjectCodeSourceLine(), false);
595:            }
596:
597:            public void testAddAccountingLine_InvalidObjectSubType()
598:                    throws Exception {
599:                AccountingDocument doc = createDocumentWithInvalidObjectSubType();
600:                testAddAccountingLineRule_ProcessAddAccountingLineBusinessRules(
601:                        doc, false);
602:            }
603:
604:            public void testAddAccountingLine_Valid() throws Exception {
605:                AccountingDocument doc = createDocumentWithValidObjectSubType();
606:                testAddAccountingLineRule_ProcessAddAccountingLineBusinessRules(
607:                        doc, true);
608:            }
609:
610:            public void testIsObjectSubTypeAllowed_InvalidSubType()
611:                    throws Exception {
612:                testAddAccountingLine_IsObjectSubTypeAllowed(DOCUMENT_CLASS,
613:                        getInvalidObjectSubTypeTargetLine(), false);
614:            }
615:
616:            public void testIsObjectSubTypeAllowed_ValidSubType()
617:                    throws Exception {
618:                testAddAccountingLine_IsObjectSubTypeAllowed(DOCUMENT_CLASS,
619:                        getValidObjectSubTypeTargetLine(), true);
620:            }
621:
622:            public void testProcessSaveDocument_Valid() throws Exception {
623:                testSaveDocumentRule_ProcessSaveDocument(createDocument(), true);
624:            }
625:
626:            public void testProcessSaveDocument_Invalid() throws Exception {
627:                testSaveDocumentRule_ProcessSaveDocument(
628:                        createDocumentInvalidForSave(), false);
629:            }
630:
631:            public void testProcessSaveDocument_Invalid1() throws Exception {
632:                try {
633:                    testSaveDocumentRule_ProcessSaveDocument(null, false);
634:                    fail("validated null doc");
635:                } catch (Exception e) {
636:                    assertTrue(true);
637:                }
638:            }
639:
640:            public void testProcessRouteDocument_Valid() throws Exception {
641:                testRouteDocumentRule_processRouteDocument(
642:                        createDocumentValidForRouting(), true);
643:            }
644:
645:            public void testProcessRouteDocument_Invalid() throws Exception {
646:                testRouteDocumentRule_processRouteDocument(createDocument(),
647:                        false);
648:            }
649:
650:            public void testProcessRouteDocument_NoAccountingLines()
651:                    throws Exception {
652:                testRouteDocumentRule_processRouteDocument(createDocument(),
653:                        false);
654:            }
655:
656:            public void testProcessRouteDocument_Unbalanced() throws Exception {
657:                testRouteDocumentRule_processRouteDocument(
658:                        createDocumentUnbalanced(), false);
659:            }
660:
661:            public void testProcessGenerateGeneralLedgerPendingEntries_validTargetExpense()
662:                    throws Exception {
663:                testGenerateGeneralLedgerPendingEntriesRule_ProcessGenerateGeneralLedgerPendingEntries(
664:                        createDocument(), getExpenseTargetLine(),
665:                        EXPECTED_GEC_EXPLICIT_TARGET_PENDING_ENTRY_FOR_EXPENSE,
666:                        EXPECTED_GEC_OFFSET_TARGET_PENDING_ENTRY);
667:            }
668:
669:            public void testProcessGenerateGeneralLedgerPendingEntries_validSourceExpense()
670:                    throws Exception {
671:
672:                testGenerateGeneralLedgerPendingEntriesRule_ProcessGenerateGeneralLedgerPendingEntries(
673:                        createDocument(), getExpenseSourceLine(),
674:                        EXPECTED_GEC_EXPLICIT_SOURCE_PENDING_ENTRY_FOR_EXPENSE,
675:                        EXPECTED_GEC_OFFSET_SOURCE_PENDING_ENTRY);
676:            }
677:
678:            public void testProcessGenerateGeneralLedgerPendingEntries_validSourceAsset()
679:                    throws Exception {
680:                testGenerateGeneralLedgerPendingEntriesRule_ProcessGenerateGeneralLedgerPendingEntries(
681:                        createDocument(), getAssetSourceLine(),
682:                        EXPECTED_GEC_EXPLICIT_SOURCE_PENDING_ENTRY,
683:                        EXPECTED_GEC_OFFSET_SOURCE_PENDING_ENTRY);
684:            }
685:
686:            public void testProcessGenerateGeneralLedgerPendingEntries_validTargetAsset()
687:                    throws Exception {
688:                testGenerateGeneralLedgerPendingEntriesRule_ProcessGenerateGeneralLedgerPendingEntries(
689:                        createDocument(), getAssetTargetLine(),
690:                        EXPECTED_GEC_EXPLICIT_TARGET_PENDING_ENTRY,
691:                        EXPECTED_GEC_OFFSET_TARGET_PENDING_ENTRY);
692:            }
693:
694:            private GeneralErrorCorrectionDocument createDocument()
695:                    throws Exception {
696:                return DocumentTestUtils.createDocument(SpringContext
697:                        .getBean(DocumentService.class),
698:                        GeneralErrorCorrectionDocument.class);
699:            }
700:
701:            private GeneralErrorCorrectionDocument createDocumentValidForRouting()
702:                    throws Exception {
703:                return createDocumentWithValidObjectSubType();
704:            }
705:
706:            private GeneralErrorCorrectionDocument createDocumentInvalidForSave()
707:                    throws Exception {
708:                return getDocumentParameterNoDescription();
709:            }
710:
711:            private GeneralErrorCorrectionDocument createDocumentWithValidObjectSubType()
712:                    throws Exception {
713:                GeneralErrorCorrectionDocument retval = createDocument();
714:                retval
715:                        .setSourceAccountingLines(getValidObjectSubTypeSourceLines());
716:                retval
717:                        .setTargetAccountingLines(getValidObjectSubTypeTargetLines());
718:                return retval;
719:            }
720:
721:            private GeneralErrorCorrectionDocument getDocumentParameterNoDescription()
722:                    throws Exception {
723:                GeneralErrorCorrectionDocument document = DocumentTestUtils
724:                        .createDocument(SpringContext
725:                                .getBean(DocumentService.class),
726:                                GeneralErrorCorrectionDocument.class);
727:                document.getDocumentHeader().setFinancialDocumentDescription(
728:                        null);
729:                return document;
730:            }
731:
732:            private SourceAccountingLine getExpenseSourceLine()
733:                    throws Exception {
734:                return EXPENSE_GEC_LINE.createAccountingLine(
735:                        SourceAccountingLine.class, KFSConstants.GL_DEBIT_CODE);
736:            }
737:
738:            private TargetAccountingLine getExpenseTargetLine()
739:                    throws Exception {
740:                return EXPENSE_GEC_LINE
741:                        .createAccountingLine(TargetAccountingLine.class,
742:                                KFSConstants.GL_CREDIT_CODE);
743:            }
744:
745:            private TargetAccountingLine getAssetTargetLine() throws Exception {
746:                return getAccruedIncomeTargetLineParameter();
747:            }
748:
749:            private TargetAccountingLine getValidObjectSubTypeTargetLine()
750:                    throws Exception {
751:                return getAccruedIncomeTargetLineParameter();
752:            }
753:
754:            private TargetAccountingLine getInvalidObjectSubTypeTargetLine()
755:                    throws Exception {
756:                return CASH_LINE.createTargetAccountingLine();
757:            }
758:
759:            private List<SourceAccountingLine> getValidObjectSubTypeSourceLines()
760:                    throws Exception {
761:                List<SourceAccountingLine> retval = new ArrayList<SourceAccountingLine>();
762:                retval.add(getAccruedIncomeSourceLineParameter());
763:                retval.add(getAccruedIncomeSourceLineParameter());
764:                return retval;
765:            }
766:
767:            private List<SourceAccountingLine> getInvalidObjectSubTypeSourceLines()
768:                    throws Exception {
769:                List<SourceAccountingLine> retval = new ArrayList<SourceAccountingLine>();
770:                retval.add(CASH_LINE.createSourceAccountingLine());
771:                retval.add(LOSSS_ON_RETIRE_LINE.createSourceAccountingLine());
772:                return retval;
773:            }
774:
775:            private List<TargetAccountingLine> getInvalidObjectSubTypeTargetLines()
776:                    throws Exception {
777:                List<TargetAccountingLine> retval = new ArrayList<TargetAccountingLine>();
778:                retval.add(CASH_LINE.createTargetAccountingLine());
779:                retval.add(LOSSS_ON_RETIRE_LINE.createTargetAccountingLine());
780:                return retval;
781:            }
782:
783:            private List<TargetAccountingLine> getValidObjectSubTypeTargetLines()
784:                    throws Exception {
785:                List<TargetAccountingLine> retval = new ArrayList<TargetAccountingLine>();
786:                retval.add(getAccruedIncomeTargetLineParameter());
787:                retval.add(getAccruedIncomeTargetLineParameter());
788:                return retval;
789:            }
790:
791:            private SourceAccountingLine getValidObjectTypeSourceLine()
792:                    throws Exception {
793:                return LINE8.createSourceAccountingLine();
794:            }
795:
796:            private SourceAccountingLine getInvalidObjectTypeSourceLine()
797:                    throws Exception {
798:                return LINE16.createSourceAccountingLine();
799:            }
800:
801:            private SourceAccountingLine getInvalidObjectCodeSourceLine()
802:                    throws Exception {
803:                return LINE10.createSourceAccountingLine();
804:            }
805:
806:            private SourceAccountingLine getValidObjectCodeSourceLine()
807:                    throws Exception {
808:                return ACCRUED_INCOME_LINE.createAccountingLine(
809:                        SourceAccountingLine.class, KFSConstants.GL_DEBIT_CODE);
810:            }
811:
812:            private SourceAccountingLine getAssetSourceLine() throws Exception {
813:                return ACCRUED_INCOME_LINE.createAccountingLine(
814:                        SourceAccountingLine.class, KFSConstants.GL_DEBIT_CODE);
815:            }
816:
817:            private GeneralErrorCorrectionDocument createDocumentWithInvalidObjectSubType()
818:                    throws Exception {
819:                GeneralErrorCorrectionDocument retval = createDocument();
820:                retval
821:                        .setSourceAccountingLines(getInvalidObjectSubTypeSourceLines());
822:                retval
823:                        .setTargetAccountingLines(getInvalidObjectSubTypeTargetLines());
824:                return retval;
825:            }
826:
827:            private GeneralErrorCorrectionDocument createDocumentUnbalanced()
828:                    throws Exception {
829:                GeneralErrorCorrectionDocument retval = createDocument();
830:                retval
831:                        .setSourceAccountingLines(getInvalidObjectSubTypeSourceLines());
832:                retval
833:                        .addTargetAccountingLine(getValidObjectSubTypeTargetLine());
834:                return retval;
835:            }
836:
837:            private SourceAccountingLine getAccruedIncomeSourceLineParameter()
838:                    throws Exception {
839:                return ACCRUED_INCOME_LINE.createAccountingLine(
840:                        SourceAccountingLine.class, KFSConstants.GL_DEBIT_CODE);
841:            }
842:
843:            private TargetAccountingLine getAccruedIncomeTargetLineParameter()
844:                    throws Exception {
845:                return ACCRUED_INCOME_LINE
846:                        .createAccountingLine(TargetAccountingLine.class,
847:                                KFSConstants.GL_CREDIT_CODE);
848:            }
849:
850:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.