Source Code Cross Referenced for TransferOfFundsDocumentRuleTest.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) 


0001:        /*
0002:         * Copyright 2005-2007 The Kuali Foundation.
0003:         * 
0004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
0005:         * you may not use this file except in compliance with the License.
0006:         * You may obtain a copy of the License at
0007:         * 
0008:         * http://www.opensource.org/licenses/ecl1.php
0009:         * 
0010:         * Unless required by applicable law or agreed to in writing, software
0011:         * distributed under the License is distributed on an "AS IS" BASIS,
0012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013:         * See the License for the specific language governing permissions and
0014:         * limitations under the License.
0015:         */
0016:        package org.kuali.module.financial.rules;
0017:
0018:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testAddAccountingLineRule_IsObjectCodeAllowed;
0019:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testAddAccountingLineRule_IsObjectTypeAllowed;
0020:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testAddAccountingLineRule_ProcessAddAccountingLineBusinessRules;
0021:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testAddAccountingLine_IsObjectSubTypeAllowed;
0022:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testGenerateGeneralLedgerPendingEntriesRule_ProcessGenerateGeneralLedgerPendingEntries;
0023:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testRouteDocumentRule_processRouteDocument;
0024:        import static org.kuali.module.financial.rules.AccountingDocumentRuleTestUtils.testSaveDocumentRule_ProcessSaveDocument;
0025:        import static org.kuali.module.financial.rules.IsDebitTestUtils.Amount.NEGATIVE;
0026:        import static org.kuali.module.financial.rules.IsDebitTestUtils.Amount.POSITIVE;
0027:        import static org.kuali.test.fixtures.AccountingLineFixture.EXPENSE_LINE;
0028:        import static org.kuali.test.fixtures.AccountingLineFixture.FLEXIBLE_EXPENSE_LINE;
0029:        import static org.kuali.test.fixtures.AccountingLineFixture.LINE10;
0030:        import static org.kuali.test.fixtures.AccountingLineFixture.LINE11;
0031:        import static org.kuali.test.fixtures.AccountingLineFixture.LINE12;
0032:        import static org.kuali.test.fixtures.AccountingLineFixture.LINE13;
0033:        import static org.kuali.test.fixtures.AccountingLineFixture.LINE8;
0034:        import static org.kuali.test.fixtures.AccountingLineFixture.LINE9;
0035:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_EXPLICIT_SOURCE_PENDING_ENTRY_FOR_EXPENSE;
0036:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_EXPLICIT_TARGET_PENDING_ENTRY_FOR_EXPENSE;
0037:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_FLEXIBLE_EXPLICIT_SOURCE_PENDING_ENTRY_FOR_EXPENSE;
0038:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_FLEXIBLE_EXPLICIT_SOURCE_PENDING_ENTRY_FOR_EXPENSE2;
0039:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_FLEXIBLE_OFFSET_SOURCE_PENDING_ENTRY;
0040:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_FLEXIBLE_OFFSET_SOURCE_PENDING_ENTRY_MISSING_OFFSET_DEFINITION;
0041:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_OFFSET_SOURCE_PENDING_ENTRY;
0042:        import static org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture.EXPECTED_OFFSET_TARGET_PENDING_ENTRY;
0043:        import static org.kuali.test.fixtures.UserNameFixture.KHUNTLEY;
0044:        import static org.kuali.test.util.KualiTestAssertionUtils.assertGlobalErrorMapContains;
0045:
0046:        import java.util.ArrayList;
0047:        import java.util.List;
0048:
0049:        import org.kuali.core.service.DataDictionaryService;
0050:        import org.kuali.core.service.DocumentService;
0051:        import org.kuali.core.service.DocumentTypeService;
0052:        import org.kuali.core.util.KualiDecimal;
0053:        import org.kuali.kfs.KFSConstants;
0054:        import org.kuali.kfs.KFSKeyConstants;
0055:        import org.kuali.kfs.bo.AccountingLine;
0056:        import org.kuali.kfs.bo.SourceAccountingLine;
0057:        import org.kuali.kfs.bo.TargetAccountingLine;
0058:        import org.kuali.kfs.context.KualiTestBase;
0059:        import org.kuali.kfs.context.SpringContext;
0060:        import org.kuali.kfs.context.TestUtils;
0061:        import org.kuali.kfs.document.AccountingDocument;
0062:        import org.kuali.module.chart.bo.OffsetDefinition;
0063:        import org.kuali.module.financial.document.TransferOfFundsDocument;
0064:        import org.kuali.test.ConfigureContext;
0065:        import org.kuali.test.DocumentTestUtils;
0066:        import org.kuali.test.fixtures.GeneralLedgerPendingEntryFixture;
0067:        import org.kuali.test.suite.AnnotationTestSuite;
0068:        import org.kuali.test.suite.CrossSectionSuite;
0069:
0070:        @ConfigureContext(session=KHUNTLEY)
0071:        public class TransferOfFundsDocumentRuleTest extends KualiTestBase {
0072:            public static final Class<TransferOfFundsDocument> DOCUMENT_CLASS = TransferOfFundsDocument.class;
0073:
0074:            private static final String NON_MANDATORY_TRANSFER_OBJECT_CODE = "1669";
0075:
0076:            @AnnotationTestSuite(CrossSectionSuite.class)
0077:            public void testProcessGenerateGeneralLedgerPendingEntries_validSourceExpenseFlexibleOffset()
0078:                    throws Exception {
0079:                TestUtils
0080:                        .setSystemParameter(
0081:                                OffsetDefinition.class,
0082:                                KFSConstants.SystemGroupParameterNames.FLEXIBLE_OFFSET_ENABLED_FLAG,
0083:                                "Y");
0084:                testGenerateGeneralLedgerPendingEntriesRule_ProcessGenerateGeneralLedgerPendingEntries(
0085:                        createDocument(),
0086:                        FLEXIBLE_EXPENSE_LINE.createTargetAccountingLine(),
0087:                        EXPECTED_FLEXIBLE_EXPLICIT_SOURCE_PENDING_ENTRY_FOR_EXPENSE2,
0088:                        EXPECTED_FLEXIBLE_OFFSET_SOURCE_PENDING_ENTRY);
0089:            }
0090:
0091:            public void testProcessGenerateGeneralLedgerPendingEntries_validSourceExpenseMissingOffsetDefinition()
0092:                    throws Exception {
0093:                TestUtils
0094:                        .setSystemParameter(
0095:                                OffsetDefinition.class,
0096:                                KFSConstants.SystemGroupParameterNames.FLEXIBLE_OFFSET_ENABLED_FLAG,
0097:                                "Y");
0098:                TransferOfFundsDocument document = DocumentTestUtils
0099:                        .createDocument(SpringContext
0100:                                .getBean(DocumentService.class),
0101:                                TransferOfFundsDocument.class);
0102:                document.setPostingYear(2000); // because our test database has no offset definitions (GL_OFFSET_DEFN_T) for
0103:                // UNIV_FISCAL_YR=2000.
0104:                document.setPostingPeriodCode("06"); // because this BO reveals no change when the year is set by itself.
0105:                AccountingLine accountingLine = FLEXIBLE_EXPENSE_LINE
0106:                        .createSourceAccountingLine();
0107:                GeneralLedgerPendingEntryFixture expectedExplicit = EXPECTED_FLEXIBLE_EXPLICIT_SOURCE_PENDING_ENTRY_FOR_EXPENSE;
0108:                GeneralLedgerPendingEntryFixture expectedOffset = EXPECTED_FLEXIBLE_OFFSET_SOURCE_PENDING_ENTRY_MISSING_OFFSET_DEFINITION;
0109:
0110:                boolean ruleResult = testGenerateGeneralLedgerPendingEntriesRule_ProcessGenerateGeneralLedgerPendingEntries(
0111:                        document, accountingLine, expectedExplicit,
0112:                        expectedOffset);
0113:                assertEquals(false, ruleResult);
0114:                assertGlobalErrorMapContains(
0115:                        KFSConstants.GENERAL_LEDGER_PENDING_ENTRIES_TAB_ERRORS,
0116:                        KFSKeyConstants.ERROR_DOCUMENT_NO_OFFSET_DEFINITION);
0117:            }
0118:
0119:            public void testIsDebit_source_income_positveAmount()
0120:                    throws Exception {
0121:                AccountingDocument accountingDocument = IsDebitTestUtils
0122:                        .getDocument(SpringContext
0123:                                .getBean(DocumentService.class),
0124:                                TransferOfFundsDocument.class);
0125:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0126:                        accountingDocument, SourceAccountingLine.class,
0127:                        POSITIVE);
0128:
0129:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
0130:                        .getBean(DocumentTypeService.class), SpringContext
0131:                        .getBean(DataDictionaryService.class),
0132:                        accountingDocument, accountingLine));
0133:            }
0134:
0135:            public void testIsDebit_source_income_negativeAmount()
0136:                    throws Exception {
0137:                AccountingDocument accountingDocument = IsDebitTestUtils
0138:                        .getDocument(SpringContext
0139:                                .getBean(DocumentService.class),
0140:                                TransferOfFundsDocument.class);
0141:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0142:                        accountingDocument, SourceAccountingLine.class,
0143:                        NEGATIVE);
0144:
0145:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0146:                        SpringContext.getBean(DocumentTypeService.class),
0147:                        SpringContext.getBean(DataDictionaryService.class),
0148:                        accountingDocument, accountingLine));
0149:            }
0150:
0151:            public void testIsDebit_source_income_zeroAmount() throws Exception {
0152:
0153:                AccountingDocument accountingDocument = IsDebitTestUtils
0154:                        .getDocument(SpringContext
0155:                                .getBean(DocumentService.class),
0156:                                TransferOfFundsDocument.class);
0157:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0158:                        accountingDocument, SourceAccountingLine.class,
0159:                        KualiDecimal.ZERO);
0160:
0161:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0162:                        SpringContext.getBean(DocumentTypeService.class),
0163:                        SpringContext.getBean(DataDictionaryService.class),
0164:                        accountingDocument, accountingLine));
0165:            }
0166:
0167:            public void testIsDebit_source_expense_positveAmount()
0168:                    throws Exception {
0169:                AccountingDocument accountingDocument = IsDebitTestUtils
0170:                        .getDocument(SpringContext
0171:                                .getBean(DocumentService.class),
0172:                                TransferOfFundsDocument.class);
0173:                AccountingLine accountingLine = IsDebitTestUtils
0174:                        .getExpenseLine(accountingDocument,
0175:                                SourceAccountingLine.class, POSITIVE);
0176:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
0177:                        .getBean(DocumentTypeService.class), SpringContext
0178:                        .getBean(DataDictionaryService.class),
0179:                        accountingDocument, accountingLine));
0180:            }
0181:
0182:            public void testIsDebit_source_expense_negativeAmount()
0183:                    throws Exception {
0184:                AccountingDocument accountingDocument = IsDebitTestUtils
0185:                        .getDocument(SpringContext
0186:                                .getBean(DocumentService.class),
0187:                                TransferOfFundsDocument.class);
0188:                AccountingLine accountingLine = IsDebitTestUtils
0189:                        .getExpenseLine(accountingDocument,
0190:                                SourceAccountingLine.class, NEGATIVE);
0191:
0192:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0193:                        SpringContext.getBean(DocumentTypeService.class),
0194:                        SpringContext.getBean(DataDictionaryService.class),
0195:                        accountingDocument, accountingLine));
0196:            }
0197:
0198:            public void testIsDebit_source_expense_zeroAmount()
0199:                    throws Exception {
0200:                AccountingDocument accountingDocument = IsDebitTestUtils
0201:                        .getDocument(SpringContext
0202:                                .getBean(DocumentService.class),
0203:                                TransferOfFundsDocument.class);
0204:                AccountingLine accountingLine = IsDebitTestUtils
0205:                        .getExpenseLine(accountingDocument,
0206:                                SourceAccountingLine.class, KualiDecimal.ZERO);
0207:
0208:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0209:                        SpringContext.getBean(DocumentTypeService.class),
0210:                        SpringContext.getBean(DataDictionaryService.class),
0211:                        accountingDocument, accountingLine));
0212:            }
0213:
0214:            public void testIsDebit_source_asset_positveAmount()
0215:                    throws Exception {
0216:                AccountingDocument accountingDocument = IsDebitTestUtils
0217:                        .getDocument(SpringContext
0218:                                .getBean(DocumentService.class),
0219:                                TransferOfFundsDocument.class);
0220:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0221:                        accountingDocument, SourceAccountingLine.class,
0222:                        POSITIVE);
0223:
0224:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0225:                        SpringContext.getBean(DocumentTypeService.class),
0226:                        SpringContext.getBean(DataDictionaryService.class),
0227:                        accountingDocument, accountingLine));
0228:            }
0229:
0230:            public void testIsDebit_source_asset_negativeAmount()
0231:                    throws Exception {
0232:                AccountingDocument accountingDocument = IsDebitTestUtils
0233:                        .getDocument(SpringContext
0234:                                .getBean(DocumentService.class),
0235:                                TransferOfFundsDocument.class);
0236:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0237:                        accountingDocument, SourceAccountingLine.class,
0238:                        NEGATIVE);
0239:
0240:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0241:                        SpringContext.getBean(DocumentTypeService.class),
0242:                        SpringContext.getBean(DataDictionaryService.class),
0243:                        accountingDocument, accountingLine));
0244:            }
0245:
0246:            public void testIsDebit_source_asset_zeroAmount() throws Exception {
0247:                AccountingDocument accountingDocument = IsDebitTestUtils
0248:                        .getDocument(SpringContext
0249:                                .getBean(DocumentService.class),
0250:                                TransferOfFundsDocument.class);
0251:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0252:                        accountingDocument, SourceAccountingLine.class,
0253:                        KualiDecimal.ZERO);
0254:
0255:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0256:                        SpringContext.getBean(DocumentTypeService.class),
0257:                        SpringContext.getBean(DataDictionaryService.class),
0258:                        accountingDocument, accountingLine));
0259:            }
0260:
0261:            public void testIsDebit_source_liability_positveAmount()
0262:                    throws Exception {
0263:                AccountingDocument accountingDocument = IsDebitTestUtils
0264:                        .getDocument(SpringContext
0265:                                .getBean(DocumentService.class),
0266:                                TransferOfFundsDocument.class);
0267:                AccountingLine accountingLine = IsDebitTestUtils
0268:                        .getLiabilityLine(accountingDocument,
0269:                                SourceAccountingLine.class, POSITIVE);
0270:
0271:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0272:                        SpringContext.getBean(DocumentTypeService.class),
0273:                        SpringContext.getBean(DataDictionaryService.class),
0274:                        accountingDocument, accountingLine));
0275:            }
0276:
0277:            public void testIsDebit_source_liability_negativeAmount()
0278:                    throws Exception {
0279:                AccountingDocument accountingDocument = IsDebitTestUtils
0280:                        .getDocument(SpringContext
0281:                                .getBean(DocumentService.class),
0282:                                TransferOfFundsDocument.class);
0283:                AccountingLine accountingLine = IsDebitTestUtils
0284:                        .getLiabilityLine(accountingDocument,
0285:                                SourceAccountingLine.class, NEGATIVE);
0286:
0287:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0288:                        SpringContext.getBean(DocumentTypeService.class),
0289:                        SpringContext.getBean(DataDictionaryService.class),
0290:                        accountingDocument, accountingLine));
0291:            }
0292:
0293:            public void testIsDebit_source_liability_zeroAmount()
0294:                    throws Exception {
0295:                AccountingDocument accountingDocument = IsDebitTestUtils
0296:                        .getDocument(SpringContext
0297:                                .getBean(DocumentService.class),
0298:                                TransferOfFundsDocument.class);
0299:                AccountingLine accountingLine = IsDebitTestUtils
0300:                        .getLiabilityLine(accountingDocument,
0301:                                SourceAccountingLine.class, KualiDecimal.ZERO);
0302:
0303:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0304:                        SpringContext.getBean(DocumentTypeService.class),
0305:                        SpringContext.getBean(DataDictionaryService.class),
0306:                        accountingDocument, accountingLine));
0307:            }
0308:
0309:            public void testIsDebit_target_income_positveAmount()
0310:                    throws Exception {
0311:                AccountingDocument accountingDocument = IsDebitTestUtils
0312:                        .getDocument(SpringContext
0313:                                .getBean(DocumentService.class),
0314:                                TransferOfFundsDocument.class);
0315:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0316:                        accountingDocument, TargetAccountingLine.class,
0317:                        POSITIVE);
0318:
0319:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
0320:                        .getBean(DocumentTypeService.class), SpringContext
0321:                        .getBean(DataDictionaryService.class),
0322:                        accountingDocument, accountingLine));
0323:            }
0324:
0325:            public void testIsDebit_target_income_negativeAmount()
0326:                    throws Exception {
0327:                AccountingDocument accountingDocument = IsDebitTestUtils
0328:                        .getDocument(SpringContext
0329:                                .getBean(DocumentService.class),
0330:                                TransferOfFundsDocument.class);
0331:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0332:                        accountingDocument, TargetAccountingLine.class,
0333:                        NEGATIVE);
0334:
0335:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0336:                        SpringContext.getBean(DocumentTypeService.class),
0337:                        SpringContext.getBean(DataDictionaryService.class),
0338:                        accountingDocument, accountingLine));
0339:            }
0340:
0341:            public void testIsDebit_target_income_zeroAmount() throws Exception {
0342:
0343:                AccountingDocument accountingDocument = IsDebitTestUtils
0344:                        .getDocument(SpringContext
0345:                                .getBean(DocumentService.class),
0346:                                TransferOfFundsDocument.class);
0347:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0348:                        accountingDocument, TargetAccountingLine.class,
0349:                        KualiDecimal.ZERO);
0350:
0351:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0352:                        SpringContext.getBean(DocumentTypeService.class),
0353:                        SpringContext.getBean(DataDictionaryService.class),
0354:                        accountingDocument, accountingLine));
0355:            }
0356:
0357:            public void testIsDebit_target_expense_positveAmount()
0358:                    throws Exception {
0359:                AccountingDocument accountingDocument = IsDebitTestUtils
0360:                        .getDocument(SpringContext
0361:                                .getBean(DocumentService.class),
0362:                                TransferOfFundsDocument.class);
0363:                AccountingLine accountingLine = IsDebitTestUtils
0364:                        .getExpenseLine(accountingDocument,
0365:                                TargetAccountingLine.class, POSITIVE);
0366:
0367:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
0368:                        .getBean(DocumentTypeService.class), SpringContext
0369:                        .getBean(DataDictionaryService.class),
0370:                        accountingDocument, accountingLine));
0371:            }
0372:
0373:            public void testIsDebit_target_expense_negativeAmount()
0374:                    throws Exception {
0375:                AccountingDocument accountingDocument = IsDebitTestUtils
0376:                        .getDocument(SpringContext
0377:                                .getBean(DocumentService.class),
0378:                                TransferOfFundsDocument.class);
0379:                AccountingLine accountingLine = IsDebitTestUtils
0380:                        .getExpenseLine(accountingDocument,
0381:                                TargetAccountingLine.class, NEGATIVE);
0382:
0383:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0384:                        SpringContext.getBean(DocumentTypeService.class),
0385:                        SpringContext.getBean(DataDictionaryService.class),
0386:                        accountingDocument, accountingLine));
0387:            }
0388:
0389:            public void testIsDebit_target_expense_zeroAmount()
0390:                    throws Exception {
0391:                AccountingDocument accountingDocument = IsDebitTestUtils
0392:                        .getDocument(SpringContext
0393:                                .getBean(DocumentService.class),
0394:                                TransferOfFundsDocument.class);
0395:                AccountingLine accountingLine = IsDebitTestUtils
0396:                        .getExpenseLine(accountingDocument,
0397:                                TargetAccountingLine.class, KualiDecimal.ZERO);
0398:
0399:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0400:                        SpringContext.getBean(DocumentTypeService.class),
0401:                        SpringContext.getBean(DataDictionaryService.class),
0402:                        accountingDocument, accountingLine));
0403:            }
0404:
0405:            public void testIsDebit_target_asset_positveAmount()
0406:                    throws Exception {
0407:                AccountingDocument accountingDocument = IsDebitTestUtils
0408:                        .getDocument(SpringContext
0409:                                .getBean(DocumentService.class),
0410:                                TransferOfFundsDocument.class);
0411:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0412:                        accountingDocument, TargetAccountingLine.class,
0413:                        POSITIVE);
0414:
0415:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0416:                        SpringContext.getBean(DocumentTypeService.class),
0417:                        SpringContext.getBean(DataDictionaryService.class),
0418:                        accountingDocument, accountingLine));
0419:            }
0420:
0421:            public void testIsDebit_target_asset_negativeAmount()
0422:                    throws Exception {
0423:                AccountingDocument accountingDocument = IsDebitTestUtils
0424:                        .getDocument(SpringContext
0425:                                .getBean(DocumentService.class),
0426:                                TransferOfFundsDocument.class);
0427:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0428:                        accountingDocument, TargetAccountingLine.class,
0429:                        NEGATIVE);
0430:
0431:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0432:                        SpringContext.getBean(DocumentTypeService.class),
0433:                        SpringContext.getBean(DataDictionaryService.class),
0434:                        accountingDocument, accountingLine));
0435:            }
0436:
0437:            public void testIsDebit_target_asset_zeroAmount() throws Exception {
0438:                AccountingDocument accountingDocument = IsDebitTestUtils
0439:                        .getDocument(SpringContext
0440:                                .getBean(DocumentService.class),
0441:                                TransferOfFundsDocument.class);
0442:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0443:                        accountingDocument, TargetAccountingLine.class,
0444:                        KualiDecimal.ZERO);
0445:
0446:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0447:                        SpringContext.getBean(DocumentTypeService.class),
0448:                        SpringContext.getBean(DataDictionaryService.class),
0449:                        accountingDocument, accountingLine));
0450:            }
0451:
0452:            public void testIsDebit_target_liability_positveAmount()
0453:                    throws Exception {
0454:                AccountingDocument accountingDocument = IsDebitTestUtils
0455:                        .getDocument(SpringContext
0456:                                .getBean(DocumentService.class),
0457:                                TransferOfFundsDocument.class);
0458:                AccountingLine accountingLine = IsDebitTestUtils
0459:                        .getLiabilityLine(accountingDocument,
0460:                                TargetAccountingLine.class, POSITIVE);
0461:
0462:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0463:                        SpringContext.getBean(DocumentTypeService.class),
0464:                        SpringContext.getBean(DataDictionaryService.class),
0465:                        accountingDocument, accountingLine));
0466:            }
0467:
0468:            public void testIsDebit_target_liability_negativeAmount()
0469:                    throws Exception {
0470:                AccountingDocument accountingDocument = IsDebitTestUtils
0471:                        .getDocument(SpringContext
0472:                                .getBean(DocumentService.class),
0473:                                TransferOfFundsDocument.class);
0474:                AccountingLine accountingLine = IsDebitTestUtils
0475:                        .getLiabilityLine(accountingDocument,
0476:                                TargetAccountingLine.class, NEGATIVE);
0477:
0478:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0479:                        SpringContext.getBean(DocumentTypeService.class),
0480:                        SpringContext.getBean(DataDictionaryService.class),
0481:                        accountingDocument, accountingLine));
0482:            }
0483:
0484:            public void testIsDebit_target_liability_zeroAmount()
0485:                    throws Exception {
0486:                AccountingDocument accountingDocument = IsDebitTestUtils
0487:                        .getDocument(SpringContext
0488:                                .getBean(DocumentService.class),
0489:                                TransferOfFundsDocument.class);
0490:                AccountingLine accountingLine = IsDebitTestUtils
0491:                        .getLiabilityLine(accountingDocument,
0492:                                TargetAccountingLine.class, KualiDecimal.ZERO);
0493:
0494:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0495:                        SpringContext.getBean(DocumentTypeService.class),
0496:                        SpringContext.getBean(DataDictionaryService.class),
0497:                        accountingDocument, accountingLine));
0498:            }
0499:
0500:            public void testIsDebit_errorCorrection_source_income_negativeAmount()
0501:                    throws Exception {
0502:                AccountingDocument accountingDocument = IsDebitTestUtils
0503:                        .getErrorCorrectionDocument(SpringContext
0504:                                .getBean(DocumentService.class),
0505:                                TransferOfFundsDocument.class);
0506:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0507:                        accountingDocument, SourceAccountingLine.class,
0508:                        NEGATIVE);
0509:
0510:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
0511:                        .getBean(DocumentTypeService.class), SpringContext
0512:                        .getBean(DataDictionaryService.class),
0513:                        accountingDocument, accountingLine));
0514:            }
0515:
0516:            public void testIsDebit_errorCorrection_source_expense_negativeAmount()
0517:                    throws Exception {
0518:                AccountingDocument accountingDocument = IsDebitTestUtils
0519:                        .getErrorCorrectionDocument(SpringContext
0520:                                .getBean(DocumentService.class),
0521:                                TransferOfFundsDocument.class);
0522:                AccountingLine accountingLine = IsDebitTestUtils
0523:                        .getExpenseLine(accountingDocument,
0524:                                SourceAccountingLine.class, NEGATIVE);
0525:
0526:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
0527:                        .getBean(DocumentTypeService.class), SpringContext
0528:                        .getBean(DataDictionaryService.class),
0529:                        accountingDocument, accountingLine));
0530:            }
0531:
0532:            public void testIsDebit_errorCorrection_source_asset_positveAmount()
0533:                    throws Exception {
0534:                AccountingDocument accountingDocument = IsDebitTestUtils
0535:                        .getErrorCorrectionDocument(SpringContext
0536:                                .getBean(DocumentService.class),
0537:                                TransferOfFundsDocument.class);
0538:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0539:                        accountingDocument, SourceAccountingLine.class,
0540:                        POSITIVE);
0541:
0542:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0543:                        SpringContext.getBean(DocumentTypeService.class),
0544:                        SpringContext.getBean(DataDictionaryService.class),
0545:                        accountingDocument, accountingLine));
0546:            }
0547:
0548:            public void testIsDebit_errorCorrection_source_asset_negativeAmount()
0549:                    throws Exception {
0550:                AccountingDocument accountingDocument = IsDebitTestUtils
0551:                        .getErrorCorrectionDocument(SpringContext
0552:                                .getBean(DocumentService.class),
0553:                                TransferOfFundsDocument.class);
0554:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0555:                        accountingDocument, SourceAccountingLine.class,
0556:                        NEGATIVE);
0557:
0558:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0559:                        SpringContext.getBean(DocumentTypeService.class),
0560:                        SpringContext.getBean(DataDictionaryService.class),
0561:                        accountingDocument, accountingLine));
0562:            }
0563:
0564:            public void testIsDebit_errorCorrection_source_asset_zeroAmount()
0565:                    throws Exception {
0566:                AccountingDocument accountingDocument = IsDebitTestUtils
0567:                        .getErrorCorrectionDocument(SpringContext
0568:                                .getBean(DocumentService.class),
0569:                                TransferOfFundsDocument.class);
0570:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0571:                        accountingDocument, SourceAccountingLine.class,
0572:                        KualiDecimal.ZERO);
0573:
0574:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0575:                        SpringContext.getBean(DocumentTypeService.class),
0576:                        SpringContext.getBean(DataDictionaryService.class),
0577:                        accountingDocument, accountingLine));
0578:            }
0579:
0580:            public void testIsDebit_errorCorrection_source_liability_positveAmount()
0581:                    throws Exception {
0582:                AccountingDocument accountingDocument = IsDebitTestUtils
0583:                        .getErrorCorrectionDocument(SpringContext
0584:                                .getBean(DocumentService.class),
0585:                                TransferOfFundsDocument.class);
0586:                AccountingLine accountingLine = IsDebitTestUtils
0587:                        .getLiabilityLine(accountingDocument,
0588:                                SourceAccountingLine.class, POSITIVE);
0589:
0590:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0591:                        SpringContext.getBean(DocumentTypeService.class),
0592:                        SpringContext.getBean(DataDictionaryService.class),
0593:                        accountingDocument, accountingLine));
0594:            }
0595:
0596:            public void testIsDebit_errorCorrection_source_liability_negativeAmount()
0597:                    throws Exception {
0598:                AccountingDocument accountingDocument = IsDebitTestUtils
0599:                        .getErrorCorrectionDocument(SpringContext
0600:                                .getBean(DocumentService.class),
0601:                                TransferOfFundsDocument.class);
0602:                AccountingLine accountingLine = IsDebitTestUtils
0603:                        .getLiabilityLine(accountingDocument,
0604:                                SourceAccountingLine.class, NEGATIVE);
0605:
0606:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0607:                        SpringContext.getBean(DocumentTypeService.class),
0608:                        SpringContext.getBean(DataDictionaryService.class),
0609:                        accountingDocument, accountingLine));
0610:            }
0611:
0612:            public void testIsDebit_errorCorrection_source_liability_zeroAmount()
0613:                    throws Exception {
0614:                AccountingDocument accountingDocument = IsDebitTestUtils
0615:                        .getErrorCorrectionDocument(SpringContext
0616:                                .getBean(DocumentService.class),
0617:                                TransferOfFundsDocument.class);
0618:                AccountingLine accountingLine = IsDebitTestUtils
0619:                        .getLiabilityLine(accountingDocument,
0620:                                SourceAccountingLine.class, KualiDecimal.ZERO);
0621:
0622:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0623:                        SpringContext.getBean(DocumentTypeService.class),
0624:                        SpringContext.getBean(DataDictionaryService.class),
0625:                        accountingDocument, accountingLine));
0626:            }
0627:
0628:            public void testIsDebit_errorCorrection_target_income_negativeAmount()
0629:                    throws Exception {
0630:                AccountingDocument accountingDocument = IsDebitTestUtils
0631:                        .getErrorCorrectionDocument(SpringContext
0632:                                .getBean(DocumentService.class),
0633:                                TransferOfFundsDocument.class);
0634:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0635:                        accountingDocument, TargetAccountingLine.class,
0636:                        NEGATIVE);
0637:
0638:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
0639:                        .getBean(DocumentTypeService.class), SpringContext
0640:                        .getBean(DataDictionaryService.class),
0641:                        accountingDocument, accountingLine));
0642:
0643:            }
0644:
0645:            public void testIsDebit_errorCorrection_target_expense_negativeAmount()
0646:                    throws Exception {
0647:                AccountingDocument accountingDocument = IsDebitTestUtils
0648:                        .getErrorCorrectionDocument(SpringContext
0649:                                .getBean(DocumentService.class),
0650:                                TransferOfFundsDocument.class);
0651:                AccountingLine accountingLine = IsDebitTestUtils
0652:                        .getExpenseLine(accountingDocument,
0653:                                TargetAccountingLine.class, NEGATIVE);
0654:
0655:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
0656:                        .getBean(DocumentTypeService.class), SpringContext
0657:                        .getBean(DataDictionaryService.class),
0658:                        accountingDocument, accountingLine));
0659:            }
0660:
0661:            public void testIsDebit_errorCorrection_target_asset_positveAmount()
0662:                    throws Exception {
0663:                AccountingDocument accountingDocument = IsDebitTestUtils
0664:                        .getErrorCorrectionDocument(SpringContext
0665:                                .getBean(DocumentService.class),
0666:                                TransferOfFundsDocument.class);
0667:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0668:                        accountingDocument, TargetAccountingLine.class,
0669:                        POSITIVE);
0670:
0671:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0672:                        SpringContext.getBean(DocumentTypeService.class),
0673:                        SpringContext.getBean(DataDictionaryService.class),
0674:                        accountingDocument, accountingLine));
0675:            }
0676:
0677:            public void testIsDebit_errorCorrection_target_asset_negativeAmount()
0678:                    throws Exception {
0679:                AccountingDocument accountingDocument = IsDebitTestUtils
0680:                        .getErrorCorrectionDocument(SpringContext
0681:                                .getBean(DocumentService.class),
0682:                                TransferOfFundsDocument.class);
0683:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0684:                        accountingDocument, TargetAccountingLine.class,
0685:                        NEGATIVE);
0686:
0687:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0688:                        SpringContext.getBean(DocumentTypeService.class),
0689:                        SpringContext.getBean(DataDictionaryService.class),
0690:                        accountingDocument, accountingLine));
0691:            }
0692:
0693:            public void testIsDebit_errorCorrection_target_asset_zeroAmount()
0694:                    throws Exception {
0695:                AccountingDocument accountingDocument = IsDebitTestUtils
0696:                        .getErrorCorrectionDocument(SpringContext
0697:                                .getBean(DocumentService.class),
0698:                                TransferOfFundsDocument.class);
0699:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0700:                        accountingDocument, TargetAccountingLine.class,
0701:                        KualiDecimal.ZERO);
0702:
0703:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0704:                        SpringContext.getBean(DocumentTypeService.class),
0705:                        SpringContext.getBean(DataDictionaryService.class),
0706:                        accountingDocument, accountingLine));
0707:            }
0708:
0709:            public void testIsDebit_errorCorrection_target_liability_positveAmount()
0710:                    throws Exception {
0711:                AccountingDocument accountingDocument = IsDebitTestUtils
0712:                        .getErrorCorrectionDocument(SpringContext
0713:                                .getBean(DocumentService.class),
0714:                                TransferOfFundsDocument.class);
0715:                AccountingLine accountingLine = IsDebitTestUtils
0716:                        .getLiabilityLine(accountingDocument,
0717:                                TargetAccountingLine.class, POSITIVE);
0718:
0719:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0720:                        SpringContext.getBean(DocumentTypeService.class),
0721:                        SpringContext.getBean(DataDictionaryService.class),
0722:                        accountingDocument, accountingLine));
0723:            }
0724:
0725:            public void testIsDebit_errorCorrection_target_liability_negativeAmount()
0726:                    throws Exception {
0727:                AccountingDocument accountingDocument = IsDebitTestUtils
0728:                        .getErrorCorrectionDocument(SpringContext
0729:                                .getBean(DocumentService.class),
0730:                                TransferOfFundsDocument.class);
0731:                AccountingLine accountingLine = IsDebitTestUtils
0732:                        .getLiabilityLine(accountingDocument,
0733:                                TargetAccountingLine.class, NEGATIVE);
0734:
0735:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0736:                        SpringContext.getBean(DocumentTypeService.class),
0737:                        SpringContext.getBean(DataDictionaryService.class),
0738:                        accountingDocument, accountingLine));
0739:            }
0740:
0741:            public void testIsDebit_errorCorrection_target_liability_zeroAmount()
0742:                    throws Exception {
0743:                AccountingDocument accountingDocument = IsDebitTestUtils
0744:                        .getErrorCorrectionDocument(SpringContext
0745:                                .getBean(DocumentService.class),
0746:                                TransferOfFundsDocument.class);
0747:                AccountingLine accountingLine = IsDebitTestUtils
0748:                        .getLiabilityLine(accountingDocument,
0749:                                TargetAccountingLine.class, KualiDecimal.ZERO);
0750:
0751:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0752:                        SpringContext.getBean(DocumentTypeService.class),
0753:                        SpringContext.getBean(DataDictionaryService.class),
0754:                        accountingDocument, accountingLine));
0755:            }
0756:
0757:            public void testIsObjectTypeAllowed_InvalidObjectType()
0758:                    throws Exception {
0759:                testAddAccountingLineRule_IsObjectTypeAllowed(DOCUMENT_CLASS,
0760:                        getInvalidObjectTypeSourceLine(), false);
0761:            }
0762:
0763:            public void testIsObjectTypeAllowed_Valid() throws Exception {
0764:                testAddAccountingLineRule_IsObjectTypeAllowed(DOCUMENT_CLASS,
0765:                        getValidObjectTypeSourceLine(), true);
0766:            }
0767:
0768:            public void testIsObjectCodeAllowed_Valid() throws Exception {
0769:                testAddAccountingLineRule_IsObjectCodeAllowed(DOCUMENT_CLASS,
0770:                        getValidObjectCodeSourceLine(), true);
0771:            }
0772:
0773:            public void testIsObjectCodeAllowed_InvalidObjectCode()
0774:                    throws Exception {
0775:                testAddAccountingLineRule_IsObjectCodeAllowed(DOCUMENT_CLASS,
0776:                        getInvalidObjectCodeSourceLine(), false);
0777:            }
0778:
0779:            public void testAddAccountingLine_InvalidObjectSubType()
0780:                    throws Exception {
0781:                AccountingDocument doc = createDocumentWithInvalidObjectSubType();
0782:                // make sure we are using a valid object code for this type of doc
0783:                for (int i = 0; i < doc.getSourceAccountingLines().size(); i++) {
0784:                    SourceAccountingLine sourceAccountingLine = (SourceAccountingLine) doc
0785:                            .getSourceAccountingLines().get(i);
0786:                    sourceAccountingLine
0787:                            .setFinancialObjectCode(NON_MANDATORY_TRANSFER_OBJECT_CODE);
0788:                }
0789:
0790:                for (int i = 0; i < doc.getTargetAccountingLines().size(); i++) {
0791:                    TargetAccountingLine sourceAccountingLine = (TargetAccountingLine) doc
0792:                            .getTargetAccountingLines().get(i);
0793:                    sourceAccountingLine
0794:                            .setFinancialObjectCode(NON_MANDATORY_TRANSFER_OBJECT_CODE);
0795:                }
0796:                // todo: is this correct? a test of an invalid object sub type expects an outcome of true
0797:                testAddAccountingLineRule_ProcessAddAccountingLineBusinessRules(
0798:                        doc, true);
0799:            }
0800:
0801:            public void testAddAccountingLine_Valid() throws Exception {
0802:                AccountingDocument doc = createDocumentWithValidObjectSubType();
0803:                testAddAccountingLineRule_ProcessAddAccountingLineBusinessRules(
0804:                        doc, true);
0805:            }
0806:
0807:            public void testIsObjectSubTypeAllowed_InvalidSubType()
0808:                    throws Exception {
0809:                testAddAccountingLine_IsObjectSubTypeAllowed(DOCUMENT_CLASS,
0810:                        getInvalidObjectSubTypeTargetLine(), false);
0811:            }
0812:
0813:            public void testIsObjectSubTypeAllowed_ValidSubType()
0814:                    throws Exception {
0815:                testAddAccountingLine_IsObjectSubTypeAllowed(DOCUMENT_CLASS,
0816:                        getValidObjectSubTypeTargetLine(), true);
0817:            }
0818:
0819:            public void testProcessSaveDocument_Valid() throws Exception {
0820:                testSaveDocumentRule_ProcessSaveDocument(createDocument(), true);
0821:            }
0822:
0823:            public void testProcessSaveDocument_Invalid() throws Exception {
0824:                testSaveDocumentRule_ProcessSaveDocument(
0825:                        createDocumentInvalidForSave(), false);
0826:            }
0827:
0828:            public void testProcessSaveDocument_Invalid1() throws Exception {
0829:                try {
0830:                    testSaveDocumentRule_ProcessSaveDocument(null, false);
0831:                    fail("validated null doc");
0832:                } catch (Exception e) {
0833:                    assertTrue(true);
0834:                }
0835:            }
0836:
0837:            public void testProcessRouteDocument_Valid() throws Exception {
0838:                testRouteDocumentRule_processRouteDocument(
0839:                        createDocumentValidForRouting(), true);
0840:            }
0841:
0842:            public void testProcessRouteDocument_Invalid() throws Exception {
0843:                testRouteDocumentRule_processRouteDocument(createDocument(),
0844:                        false);
0845:            }
0846:
0847:            public void testProcessRouteDocument_NoAccountingLines()
0848:                    throws Exception {
0849:                testRouteDocumentRule_processRouteDocument(createDocument(),
0850:                        false);
0851:            }
0852:
0853:            public void testProcessRouteDocument_Unbalanced() throws Exception {
0854:                testRouteDocumentRule_processRouteDocument(
0855:                        createDocumentUnbalanced(), false);
0856:            }
0857:
0858:            public void testProcessGenerateGeneralLedgerPendingEntries_validTargetExpense()
0859:                    throws Exception {
0860:                testGenerateGeneralLedgerPendingEntriesRule_ProcessGenerateGeneralLedgerPendingEntries(
0861:                        createDocument(), EXPENSE_LINE
0862:                                .createTargetAccountingLine(),
0863:                        EXPECTED_EXPLICIT_TARGET_PENDING_ENTRY_FOR_EXPENSE,
0864:                        EXPECTED_OFFSET_TARGET_PENDING_ENTRY);
0865:            }
0866:
0867:            public void testProcessGenerateGeneralLedgerPendingEntries_validSourceExpense()
0868:                    throws Exception {
0869:
0870:                testGenerateGeneralLedgerPendingEntriesRule_ProcessGenerateGeneralLedgerPendingEntries(
0871:                        createDocument(), EXPENSE_LINE
0872:                                .createSourceAccountingLine(),
0873:                        EXPECTED_EXPLICIT_SOURCE_PENDING_ENTRY_FOR_EXPENSE,
0874:                        EXPECTED_OFFSET_SOURCE_PENDING_ENTRY);
0875:            }
0876:
0877:            private TransferOfFundsDocument createDocumentValidForRouting()
0878:                    throws Exception {
0879:                TransferOfFundsDocument doc = createDocument();
0880:
0881:                KualiDecimal balance = new KualiDecimal("21.12");
0882:
0883:                SourceAccountingLine sourceLine = new SourceAccountingLine();
0884:                sourceLine.setChartOfAccountsCode("BL");
0885:                sourceLine.setAccountNumber("1031400");
0886:                sourceLine.setFinancialObjectCode("1663");
0887:                sourceLine.setAmount(balance);
0888:                sourceLine.refresh();
0889:                List<SourceAccountingLine> sourceLines = new ArrayList<SourceAccountingLine>();
0890:                sourceLines.add(sourceLine);
0891:
0892:                TargetAccountingLine targetLine = new TargetAccountingLine();
0893:                targetLine.setChartOfAccountsCode("BL");
0894:                targetLine.setAccountNumber("1031400");
0895:                targetLine.setFinancialObjectCode("5163");
0896:                targetLine.setAmount(balance);
0897:                targetLine.refresh();
0898:                List<TargetAccountingLine> targetLines = new ArrayList<TargetAccountingLine>();
0899:                targetLines.add(targetLine);
0900:
0901:                doc.setSourceAccountingLines(sourceLines);
0902:                doc.setTargetAccountingLines(targetLines);
0903:
0904:                return doc;
0905:            }
0906:
0907:            private TransferOfFundsDocument createDocumentInvalidForSave()
0908:                    throws Exception {
0909:                return getDocumentParameterNoDescription();
0910:            }
0911:
0912:            private TransferOfFundsDocument getDocumentParameterNoDescription()
0913:                    throws Exception {
0914:                TransferOfFundsDocument document = DocumentTestUtils
0915:                        .createDocument(SpringContext
0916:                                .getBean(DocumentService.class),
0917:                                TransferOfFundsDocument.class);
0918:                document.getDocumentHeader().setFinancialDocumentDescription(
0919:                        null);
0920:                return document;
0921:            }
0922:
0923:            private TransferOfFundsDocument createDocument() throws Exception {
0924:                return DocumentTestUtils.createDocument(SpringContext
0925:                        .getBean(DocumentService.class),
0926:                        TransferOfFundsDocument.class);
0927:            }
0928:
0929:            private TransferOfFundsDocument createDocumentWithValidObjectSubType()
0930:                    throws Exception {
0931:                TransferOfFundsDocument retval = createDocument();
0932:                retval
0933:                        .setSourceAccountingLines(getValidObjectSubTypeSourceLines());
0934:                retval
0935:                        .setTargetAccountingLines(getValidObjectSubTypeTargetLines());
0936:                return retval;
0937:            }
0938:
0939:            private TargetAccountingLine getValidObjectSubTypeTargetLine()
0940:                    throws Exception {
0941:                return (TargetAccountingLine) makeObjectTypeAndSubTypeValid(LINE11
0942:                        .createTargetAccountingLine());
0943:            }
0944:
0945:            private AccountingLine makeObjectTypeAndSubTypeValid(
0946:                    AccountingLine line) {
0947:                line.setFinancialObjectCode("1698"); // IN type and MT sub-type on UA chart
0948:                line.refresh();
0949:                return line;
0950:            }
0951:
0952:            private TargetAccountingLine getInvalidObjectSubTypeTargetLine()
0953:                    throws Exception {
0954:                return LINE13.createTargetAccountingLine();
0955:            }
0956:
0957:            private List<SourceAccountingLine> getValidObjectSubTypeSourceLines()
0958:                    throws Exception {
0959:                List<SourceAccountingLine> retval = new ArrayList<SourceAccountingLine>();
0960:                retval.add(getValidObjectCodeSourceLine());
0961:                return retval;
0962:            }
0963:
0964:            private List<SourceAccountingLine> getInvalidObjectSubTypeSourceLines()
0965:                    throws Exception {
0966:                List<SourceAccountingLine> retval = new ArrayList<SourceAccountingLine>();
0967:                retval.add(LINE12.createSourceAccountingLine());
0968:                retval.add(LINE12.createSourceAccountingLine());
0969:                return retval;
0970:            }
0971:
0972:            private List<TargetAccountingLine> getInvalidObjectSubTypeTargetLines()
0973:                    throws Exception {
0974:                List<TargetAccountingLine> retval = new ArrayList<TargetAccountingLine>();
0975:                retval.add(LINE11.createTargetAccountingLine());
0976:                retval.add(getInvalidObjectSubTypeTargetLine());
0977:                return retval;
0978:            }
0979:
0980:            private List<TargetAccountingLine> getValidObjectSubTypeTargetLines()
0981:                    throws Exception {
0982:                List<TargetAccountingLine> retval = new ArrayList<TargetAccountingLine>();
0983:                retval.add(LINE11.createTargetAccountingLine());
0984:                retval.add(LINE11.createTargetAccountingLine());
0985:                return retval;
0986:            }
0987:
0988:            private SourceAccountingLine getValidObjectTypeSourceLine()
0989:                    throws Exception {
0990:                return LINE8.createSourceAccountingLine();
0991:            }
0992:
0993:            private SourceAccountingLine getInvalidObjectTypeSourceLine()
0994:                    throws Exception {
0995:                SourceAccountingLine line = LINE9.createSourceAccountingLine();
0996:                line.setFinancialObjectCode("9889");
0997:                line.refresh();
0998:                assertEquals("need FB obj type because it is invalid", "FB",
0999:                        line.getObjectCode().getFinancialObjectTypeCode());
1000:                return line;
1001:            }
1002:
1003:            private SourceAccountingLine getInvalidObjectCodeSourceLine()
1004:                    throws Exception {
1005:                return LINE10.createSourceAccountingLine();
1006:            }
1007:
1008:            private SourceAccountingLine getValidObjectCodeSourceLine()
1009:                    throws Exception {
1010:
1011:                SourceAccountingLine line = LINE11.createSourceAccountingLine();
1012:
1013:                // make sure that financial object type code is IN
1014:                line.getObjectCode().setFinancialObjectTypeCode("IN");
1015:                line.setObjectTypeCode("IN");
1016:                return line;
1017:            }
1018:
1019:            private TransferOfFundsDocument createDocumentWithInvalidObjectSubType()
1020:                    throws Exception {
1021:                TransferOfFundsDocument retval = createDocument();
1022:                retval
1023:                        .setSourceAccountingLines(getInvalidObjectSubTypeSourceLines());
1024:                retval
1025:                        .setTargetAccountingLines(getInvalidObjectSubTypeTargetLines());
1026:                return retval;
1027:            }
1028:
1029:            private TransferOfFundsDocument createDocumentUnbalanced()
1030:                    throws Exception {
1031:                TransferOfFundsDocument retval = createDocument();
1032:                retval
1033:                        .addSourceAccountingLine((SourceAccountingLine) makeObjectTypeAndSubTypeValid(getValidObjectCodeSourceLine()));
1034:                retval
1035:                        .addSourceAccountingLine((SourceAccountingLine) makeObjectTypeAndSubTypeValid(getValidObjectCodeSourceLine()));
1036:                retval
1037:                        .addTargetAccountingLine(getValidObjectSubTypeTargetLine());
1038:                return retval;
1039:            }
1040:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.