Source Code Cross Referenced for OrganizationReversionLogicTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » gl » service » impl » orgreversion » 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.gl.service.impl.orgreversion 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 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.gl.service.impl.orgreversion;
0017:
0018:        import java.sql.Date;
0019:        import java.text.ParseException;
0020:        import java.text.SimpleDateFormat;
0021:        import java.util.ArrayList;
0022:        import java.util.Collection;
0023:        import java.util.HashMap;
0024:        import java.util.Iterator;
0025:        import java.util.List;
0026:        import java.util.Map;
0027:
0028:        import org.kuali.core.service.DateTimeService;
0029:        import org.kuali.core.util.KualiDecimal;
0030:        import org.kuali.kfs.KFSConstants;
0031:        import org.kuali.kfs.context.SpringContext;
0032:        import org.kuali.kfs.service.ParameterService;
0033:        import org.kuali.kfs.service.impl.ParameterConstants;
0034:        import org.kuali.module.chart.service.OrganizationReversionService;
0035:        import org.kuali.module.chart.service.PriorYearAccountService;
0036:        import org.kuali.module.financial.service.UniversityDateService;
0037:        import org.kuali.module.gl.GLConstants;
0038:        import org.kuali.module.gl.OriginEntryTestBase;
0039:        import org.kuali.module.gl.bo.Balance;
0040:        import org.kuali.module.gl.bo.OriginEntry;
0041:        import org.kuali.module.gl.bo.OriginEntryFull;
0042:        import org.kuali.module.gl.bo.OriginEntryGroup;
0043:        import org.kuali.module.gl.bo.OriginEntrySource;
0044:        import org.kuali.module.gl.service.BalanceService;
0045:        import org.kuali.module.gl.service.OrgReversionUnitOfWorkService;
0046:        import org.kuali.module.gl.service.OrganizationReversionCategoryLogic;
0047:        import org.kuali.module.gl.service.OrganizationReversionProcessService;
0048:        import org.kuali.module.gl.service.impl.OrganizationReversionMockService;
0049:        import org.kuali.test.ConfigureContext;
0050:
0051:        /**
0052:         * Tests that the Organization Reversion process generates the proper origin entries under
0053:         * certain circumstances with each of the Org Reversion logics: A, C1, C2, N1, N2, R1, R2
0054:         */
0055:        @ConfigureContext
0056:        public class OrganizationReversionLogicTest extends OriginEntryTestBase {
0057:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
0058:                    .getLogger(OrganizationReversionLogicTest.class);
0059:
0060:            public static final String DEFAULT_BALANCE_CHART = "BL";
0061:            public static final String DEFAULT_BALANCE_ACCOUNT_NBR = "1031400";
0062:
0063:            private OrganizationReversionService organizationReversionService;
0064:            private BalanceService balanceService;
0065:            private OrganizationReversionCategoryLogic cashOrganizationReversionCategoryLogic;
0066:            private OrganizationReversionProcessService organizationReversionProcessService;
0067:            private PriorYearAccountService priorYearAccountService;
0068:            private OrgReversionUnitOfWorkService orgReversionUnitOfWorkService;
0069:            private OrganizationReversionProcess orgRevProcess;
0070:            private Integer currentFiscalYear;
0071:            private Integer previousFiscalYear;
0072:
0073:            /**
0074:             * These enums are balance fixtures to test.  These fixtures come from the spreadsheet org+reversion.xls, posted as an attachment to JIRA KULRNE-5652
0075:             * A quick summary is this:
0076:             * Each scenario needs a fixture for current balance and actual balance; scenarios 4 - 7 also have encumbrances.
0077:             * Scenario 1: Budget exceeds actual
0078:             * Scenario 2: Actual exceeds budget
0079:             * Scenario 3: Budget equals actual
0080:             * Scenario 4: Budget exceeds actual + encumbrance
0081:             * Scenario 5: Budget equals actual + encumbrance
0082:             * Scenario 6: Actual + encumbrance exceeds budget
0083:             * Scenario 7: Actual exceeds budget, and there's an encumbrance to boot
0084:             */
0085:            enum BALANCE_FIXTURE {
0086:                SCENARIO1_CURRENT_BUDGET_BALANCE("CB", new KualiDecimal(5000)), SCENARIO1_ACTUAL_BALANCE(
0087:                        "AC", new KualiDecimal(3000)),
0088:
0089:                SCENARIO2_CURRENT_BUDGET_BALANCE("CB", new KualiDecimal(4000)), SCENARIO2_ACTUAL_BALANCE(
0090:                        "AC", new KualiDecimal(7000)),
0091:
0092:                SCENARIO3_CURRENT_BUDGET_BALANCE("CB", new KualiDecimal(2000)), SCENARIO3_ACTUAL_BALANCE(
0093:                        "AC", new KualiDecimal(2000)),
0094:
0095:                SCENARIO4_CURRENT_BUDGET_BALANCE("CB", new KualiDecimal(5000)), SCENARIO4_ACTUAL_BALANCE(
0096:                        "AC", new KualiDecimal(3000)), SCENARIO4_ENCUMBRANCE_BALANCE(
0097:                        "IE", new KualiDecimal(500)),
0098:
0099:                SCENARIO5_CURRENT_BUDGET_BALANCE("CB", new KualiDecimal(5000)), SCENARIO5_ACTUAL_BALANCE(
0100:                        "AC", new KualiDecimal(3000)), SCENARIO5_ENCUMBRANCE_BALANCE(
0101:                        "IE", new KualiDecimal(2000)),
0102:
0103:                SCENARIO6_CURRENT_BUDGET_BALANCE("CB", new KualiDecimal(5000)), SCENARIO6_ACTUAL_BALANCE(
0104:                        "AC", new KualiDecimal(3000)), SCENARIO6_ENCUMBRANCE_BALANCE(
0105:                        "IE", new KualiDecimal(2500)),
0106:
0107:                SCENARIO7_CURRENT_BUDGET_BALANCE("CB", new KualiDecimal(4000)), SCENARIO7_ACTUAL_BALANCE(
0108:                        "AC", new KualiDecimal(7000)), SCENARIO7_ENCUMBRANCE_BALANCE(
0109:                        "IE", new KualiDecimal(500));
0110:
0111:                private String objectCode;
0112:                private String balanceTypeCode;
0113:                private String objectTypeCode;
0114:                private KualiDecimal amount;
0115:                private Date timestamp;
0116:                private static final String DATE_FORMAT = "yyyy-MM-dd";
0117:                private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
0118:                        .getLogger(BALANCE_FIXTURE.class);
0119:
0120:                /**
0121:                 * Constructs a OrganizationReversionLogicTest.BALANCE_FIXTURE instance
0122:                 * @param balanceTypeCode the type code of the balance to create
0123:                 * @param amount the amount of the balance to create
0124:                 */
0125:                private BALANCE_FIXTURE(String balanceTypeCode,
0126:                        KualiDecimal amount) {
0127:                    this .balanceTypeCode = balanceTypeCode;
0128:                    this .amount = amount;
0129:                }
0130:
0131:                /**
0132:                 * Sets the object code of the object (so the same fixture can be used for multiple categories)
0133:                 * @param objectCode the object code to set
0134:                 */
0135:                public void setObjectCode(String objectCode) {
0136:                    this .objectCode = objectCode;
0137:                }
0138:
0139:                /**
0140:                 * Converts the fixture into a balance to test
0141:                 * 
0142:                 * @return a balance represented by this fixture
0143:                 */
0144:                public Balance convertToBalance() {
0145:                    Balance balance = new Balance();
0146:                    balance.setUniversityFiscalYear(new Integer((SpringContext
0147:                            .getBean(UniversityDateService.class)
0148:                            .getCurrentFiscalYear()).intValue() - 1));
0149:                    balance.setChartOfAccountsCode(DEFAULT_BALANCE_CHART);
0150:                    balance.setAccountNumber(DEFAULT_BALANCE_ACCOUNT_NBR);
0151:                    balance.setSubAccountNumber(KFSConstants
0152:                            .getDashSubAccountNumber());
0153:                    balance.setObjectCode(objectCode);
0154:                    balance.setSubObjectCode(KFSConstants
0155:                            .getDashFinancialSubObjectCode());
0156:                    balance.setBalanceTypeCode(balanceTypeCode);
0157:                    balance.setObjectTypeCode("EX");
0158:                    balance.setAccountLineAnnualBalanceAmount(amount);
0159:                    balance.setBeginningBalanceLineAmount(KualiDecimal.ZERO);
0160:                    balance
0161:                            .setContractsGrantsBeginningBalanceAmount(KualiDecimal.ZERO);
0162:                    balance.setMonth1Amount(amount);
0163:                    balance.setMonth2Amount(KualiDecimal.ZERO);
0164:                    balance.setMonth3Amount(KualiDecimal.ZERO);
0165:                    balance.setMonth4Amount(KualiDecimal.ZERO);
0166:                    balance.setMonth5Amount(KualiDecimal.ZERO);
0167:                    balance.setMonth6Amount(KualiDecimal.ZERO);
0168:                    balance.setMonth7Amount(KualiDecimal.ZERO);
0169:                    balance.setMonth8Amount(KualiDecimal.ZERO);
0170:                    balance.setMonth9Amount(KualiDecimal.ZERO);
0171:                    balance.setMonth10Amount(KualiDecimal.ZERO);
0172:                    balance.setMonth11Amount(KualiDecimal.ZERO);
0173:                    balance.setMonth12Amount(KualiDecimal.ZERO);
0174:                    balance.setMonth13Amount(KualiDecimal.ZERO);
0175:                    try {
0176:                        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
0177:                        java.util.Date jud = sdf
0178:                                .parse(SpringContext
0179:                                        .getBean(ParameterService.class)
0180:                                        .getParameterValue(
0181:                                                ParameterConstants.GENERAL_LEDGER_BATCH.class,
0182:                                                GLConstants.ANNUAL_CLOSING_TRANSACTION_DATE_PARM));
0183:                        balance.setTimestamp(new java.sql.Date(jud.getTime()));
0184:                    } catch (ParseException e) {
0185:                        LOG
0186:                                .debug("Parse date exception while parsing transaction date");
0187:                    }
0188:                    balance.refresh();
0189:                    return balance;
0190:                }
0191:            };
0192:
0193:            /**
0194:             * Fixtures that have object codes that will go into certain categories.  OrganizationReversionMockService
0195:             * makes certain that each category represents different logic.
0196:             * @see org.kuali.module.gl.service.impl.OrganizationReversionMockService
0197:             */
0198:            enum OBJECT_CODE_FIXTURE {
0199:                C01_ORG_WAGES_CODE("3000"), // C01 = A logic
0200:                C02_SALARY_FRINGES_CODE("2400"), // C02 = C1 logic
0201:                C03_FINANCIAL_AID_CODE("5880"), // C03 = C2 logic
0202:                C04_CAPITAL_EQUIP_CODE("7200"), // C04 = N1 logic
0203:                C05_RESERVE_CODE("7990"), // C05 = N2 logic
0204:                C08_TRAVEL_CODE("6000"), // C08 = R1 logic
0205:                C09_OTHER_EXPENSE_CODE("4100"); // C09 = R2 logic
0206:
0207:                private String code;
0208:
0209:                /**
0210:                 * Constructs a OrganizationReversionLogicTest.OBJECT_CODE_FIXTURE instance
0211:                 * @param code the object code represented by this fixture
0212:                 */
0213:                private OBJECT_CODE_FIXTURE(String code) {
0214:                    this .code = code;
0215:                }
0216:
0217:                /**
0218:                 * Returns the object code
0219:                 * @return the object code
0220:                 */
0221:                public String getCode() {
0222:                    return this .code;
0223:                }
0224:            }
0225:
0226:            /**
0227:             * Does the prelinary work of setting up the test...getting the org reversion mock, setting up
0228:             * the parameters for the job, and creates the OrganizationReversionProcess object that will actually
0229:             * complete the job
0230:             * @see org.kuali.module.gl.OriginEntryTestBase#setUp()
0231:             */
0232:            protected void setUp() throws Exception {
0233:                super .setUp();
0234:
0235:                Map<String, OrganizationReversionService> orgRevServiceBeans = SpringContext
0236:                        .getBeansOfType(OrganizationReversionService.class);
0237:                organizationReversionService = orgRevServiceBeans
0238:                        .get("glOrganizationReversionMockService");
0239:                DateTimeService dtService = SpringContext
0240:                        .getBean(DateTimeService.class);
0241:                balanceService = SpringContext.getBean(BalanceService.class);
0242:                cashOrganizationReversionCategoryLogic = SpringContext
0243:                        .getBean(CashOrganizationReversionCategoryLogic.class);
0244:                priorYearAccountService = SpringContext
0245:                        .getBean(PriorYearAccountService.class);
0246:                orgReversionUnitOfWorkService = SpringContext
0247:                        .getBean(OrgReversionUnitOfWorkService.class);
0248:                organizationReversionProcessService = SpringContext
0249:                        .getBean(OrganizationReversionProcessService.class);
0250:
0251:                currentFiscalYear = SpringContext.getBean(
0252:                        UniversityDateService.class).getCurrentFiscalYear();
0253:                previousFiscalYear = new Integer(
0254:                        currentFiscalYear.intValue() - 1);
0255:
0256:                Map jobParameters = organizationReversionProcessService
0257:                        .getJobParameters();
0258:                Map<String, Integer> organizationReversionCounts = new HashMap<String, Integer>();
0259:
0260:                orgRevProcess = new OrganizationReversionProcess(null, false,
0261:                        organizationReversionService, balanceService,
0262:                        originEntryGroupService, originEntryService,
0263:                        persistenceService, dtService,
0264:                        cashOrganizationReversionCategoryLogic,
0265:                        priorYearAccountService, orgReversionUnitOfWorkService,
0266:                        jobParameters, organizationReversionCounts);
0267:                orgRevProcess.initializeProcess();
0268:            }
0269:
0270:            /**
0271:             * Makes sure that a new OrganizationReversionProcess will be used for the next test
0272:             * @see junit.framework.TestCase#tearDown()
0273:             */
0274:            protected void tearDown() throws Exception {
0275:                orgRevProcess = null;
0276:            }
0277:
0278:            /**
0279:             * Given a list of balances, saves those balances and runs the organization reversion process on them
0280:             * 
0281:             * @param balancesToTestAgainst the balances for the specific test
0282:             * @return an OriginEntryGroup where the resultant origin entries were saved
0283:             */
0284:            protected OriginEntryGroup runOrganizationReversionProcess(
0285:                    List<Balance> balancesToTestAgainst) {
0286:                clearGlBalanceTable();
0287:                clearOriginEntryTables();
0288:                persistenceService.clearCache();
0289:                for (Balance bal : balancesToTestAgainst) {
0290:                    balanceService.save(bal);
0291:                }
0292:                OriginEntryGroup outputGroup = organizationReversionProcessService
0293:                        .createOrganizationReversionProcessOriginEntryGroup();
0294:                orgRevProcess.setOutputGroup(outputGroup);
0295:                orgRevProcess.setHoldGeneratedOriginEntries(true);
0296:                orgRevProcess.organizationReversionProcess();
0297:
0298:                // ye olde sanity check
0299:                assertEquals("Balances Read", new Integer(balancesToTestAgainst
0300:                        .size()), new Integer(orgRevProcess.getBalancesRead()));
0301:
0302:                // make sure this resulted in one Org Rev origin entry group
0303:                Collection groups = originEntryGroupService
0304:                        .getAllOriginEntryGroup();
0305:                assertEquals("Origin Entries Group Size", new Integer(1),
0306:                        new Integer(groups.size()));
0307:
0308:                OriginEntryGroup group = (OriginEntryGroup) groups.iterator()
0309:                        .next();
0310:                assertEquals("Origin Entry Group Source Code",
0311:                        OriginEntrySource.YEAR_END_ORG_REVERSION, group
0312:                                .getSourceCode());
0313:                return group;
0314:            }
0315:
0316:            /**
0317:             * Asserts that certain fields in the given origin entry equal given parameters
0318:             * @param originEntry the actual origin entry
0319:             * @param fiscalYear the expected fiscal year
0320:             * @param periodCode the expected period code
0321:             * @param chart the expected chart
0322:             * @param account the expected account
0323:             * @param objectCode the expected object code
0324:             * @param balanceType the expected balance type
0325:             * @param objectType the expected object type
0326:             * @param amount the expected amount
0327:             */
0328:            private void assertOriginEntry(OriginEntry originEntry,
0329:                    Integer fiscalYear, String periodCode, String chart,
0330:                    String account, String objectCode, String balanceType,
0331:                    String objectType, KualiDecimal amount) {
0332:                assertEquals("Origin Entry " + originEntry.toString()
0333:                        + " Fiscal Year", fiscalYear, originEntry
0334:                        .getUniversityFiscalYear());
0335:                assertEquals("Origin Entry " + originEntry.toString()
0336:                        + " Fiscal Period", periodCode, originEntry
0337:                        .getUniversityFiscalPeriodCode());
0338:                assertEquals("Origin Entry " + originEntry.toString()
0339:                        + " Chart of Accounts", chart, originEntry
0340:                        .getChartOfAccountsCode());
0341:                assertEquals("Origin Entry " + originEntry.toString()
0342:                        + " Account Number", account, originEntry
0343:                        .getAccountNumber());
0344:                assertEquals("Origin Entry " + originEntry.toString()
0345:                        + " Object Code", objectCode, originEntry
0346:                        .getFinancialObjectCode());
0347:                assertEquals("Origin Entry " + originEntry.toString()
0348:                        + " Balance Type", balanceType, originEntry
0349:                        .getFinancialBalanceTypeCode());
0350:                assertEquals("Origin Entry " + originEntry.toString()
0351:                        + " Object Type", objectType, originEntry
0352:                        .getFinancialObjectTypeCode());
0353:                assertEquals("Origin Entry " + originEntry.toString()
0354:                        + " Amount", amount, originEntry
0355:                        .getTransactionLedgerEntryAmount());
0356:            }
0357:
0358:            /**
0359:             * Takes all of the origin entries in an Iterator of entries and puts them into a List, for easier
0360:             * manipulation.
0361:             * 
0362:             * @param originEntriesIterator an Iterator of origin entries
0363:             * @return all of the entries in a list
0364:             */
0365:            private List<OriginEntryFull> putOriginEntriesInList(
0366:                    Iterator<OriginEntryFull> originEntriesIterator) {
0367:                List<OriginEntryFull> entries = new ArrayList<OriginEntryFull>();
0368:                while (originEntriesIterator.hasNext()) {
0369:                    entries.add(originEntriesIterator.next());
0370:                }
0371:                return entries;
0372:            }
0373:
0374:            /**
0375:             * Logs all the entries in a list of origin entries
0376:             * 
0377:             * @param originEntries the origin entries to log
0378:             */
0379:            private void logAllEntries(List<OriginEntryFull> originEntries) {
0380:                for (OriginEntryFull entry : originEntries) {
0381:                    LOG.info(entry.getLine());
0382:                }
0383:            }
0384:
0385:            /*
0386:             * ************** SCENARIO 1 *****************
0387:             */
0388:            /**
0389:             * Tests that Logic A generates the correct origin entries for Scenario 1, budget exceeds actual
0390:             */
0391:            public void testBudgetGreaterThanActualNoEncumbrancesLogicA() {
0392:                LOG
0393:                        .info("budget greater than actual, no encumbrances test started...");
0394:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0395:                // add balances to check A
0396:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO1_CURRENT_BUDGET_BALANCE
0397:                        .convertToBalance();
0398:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
0399:                        .getCode());
0400:                Balance acBalance = BALANCE_FIXTURE.SCENARIO1_ACTUAL_BALANCE
0401:                        .convertToBalance();
0402:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
0403:                        .getCode());
0404:                balancesToCheck.add(cbBalance);
0405:                balancesToCheck.add(acBalance);
0406:
0407:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0408:
0409:                // sanity check - all the balances were selected?
0410:                assertEquals("balances to check were all selected? ",
0411:                        new Integer(balancesToCheck.size()), new Integer(
0412:                                orgRevProcess.getBalancesSelected()));
0413:
0414:                List<OriginEntryFull> originEntries = orgRevProcess
0415:                        .getGeneratedOriginEntries();
0416:                logAllEntries(originEntries);
0417:
0418:                assertEquals("correct number of origin entries returned? ",
0419:                        new Integer(originEntries.size()), new Integer(2));
0420:
0421:                // check the origin entries
0422:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
0423:                        "01", DEFAULT_BALANCE_CHART,
0424:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
0425:                        new KualiDecimal(2000));
0426:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
0427:                        "01", DEFAULT_BALANCE_CHART,
0428:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
0429:                        new KualiDecimal(2000));
0430:            }
0431:
0432:            /**
0433:             * Tests that Logic C1 generates the correct origin entries for Scenario 1, budget exceeds actual
0434:             */
0435:            public void testBudgetGreaterThanActualNoEncumbrancesLogicC1() {
0436:                LOG
0437:                        .info("budget greater than actual, no encumbrances test started...");
0438:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0439:
0440:                // add balances to check C1
0441:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO1_CURRENT_BUDGET_BALANCE
0442:                        .convertToBalance();
0443:                cbBalance
0444:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
0445:                                .getCode());
0446:                Balance acBalance = BALANCE_FIXTURE.SCENARIO1_ACTUAL_BALANCE
0447:                        .convertToBalance();
0448:                acBalance
0449:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
0450:                                .getCode());
0451:                balancesToCheck.add(cbBalance);
0452:                balancesToCheck.add(acBalance);
0453:
0454:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0455:
0456:                assertEquals("balances to check were all selected? ",
0457:                        new Integer(balancesToCheck.size()), new Integer(
0458:                                orgRevProcess.getBalancesSelected()));
0459:
0460:                List<OriginEntryFull> originEntries = orgRevProcess
0461:                        .getGeneratedOriginEntries();
0462:                logAllEntries(originEntries);
0463:                assertEquals("correct number of origin entries returned? ",
0464:                        new Integer(originEntries.size()), new Integer(2));
0465:
0466:                // check the origin entries
0467:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
0468:                        "01", DEFAULT_BALANCE_CHART,
0469:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
0470:                        new KualiDecimal(2000));
0471:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
0472:                        "01", DEFAULT_BALANCE_CHART,
0473:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
0474:                        new KualiDecimal(2000));
0475:            }
0476:
0477:            /**
0478:             * Tests that Logic C2 generates the correct origin entries for Scenario 1, budget exceeds actual
0479:             */
0480:            public void testBudgetGreaterThanActualNoEncumbrancesLogicC2() {
0481:                LOG
0482:                        .info("budget greater than actual, no encumbrances test started...");
0483:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0484:
0485:                // add balances to check C2
0486:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO1_CURRENT_BUDGET_BALANCE
0487:                        .convertToBalance();
0488:                cbBalance
0489:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
0490:                                .getCode());
0491:                Balance acBalance = BALANCE_FIXTURE.SCENARIO1_ACTUAL_BALANCE
0492:                        .convertToBalance();
0493:                acBalance
0494:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
0495:                                .getCode());
0496:                balancesToCheck.add(cbBalance);
0497:                balancesToCheck.add(acBalance);
0498:
0499:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0500:
0501:                assertEquals("balances to check were all selected? ",
0502:                        new Integer(balancesToCheck.size()), new Integer(
0503:                                orgRevProcess.getBalancesSelected()));
0504:
0505:                List<OriginEntryFull> originEntries = orgRevProcess
0506:                        .getGeneratedOriginEntries();
0507:                logAllEntries(originEntries);
0508:                assertEquals("correct number of origin entries returned? ",
0509:                        new Integer(originEntries.size()), new Integer(2));
0510:
0511:                // check the origin entries
0512:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
0513:                        "01", DEFAULT_BALANCE_CHART,
0514:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
0515:                        new KualiDecimal(2000));
0516:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
0517:                        "01", DEFAULT_BALANCE_CHART,
0518:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
0519:                        new KualiDecimal(2000));
0520:            }
0521:
0522:            /**
0523:             * Tests that Logic N1 generates the correct origin entries for Scenario 1, budget exceeds actual
0524:             */
0525:            public void testBudgetGreaterThanActualNoEncumbrancesLogicN1() {
0526:                LOG
0527:                        .info("budget greater than actual, no encumbrances test started...");
0528:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0529:
0530:                // add balances to check N1
0531:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO1_CURRENT_BUDGET_BALANCE
0532:                        .convertToBalance();
0533:                cbBalance
0534:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
0535:                                .getCode());
0536:                Balance acBalance = BALANCE_FIXTURE.SCENARIO1_ACTUAL_BALANCE
0537:                        .convertToBalance();
0538:                acBalance
0539:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
0540:                                .getCode());
0541:                balancesToCheck.add(cbBalance);
0542:                balancesToCheck.add(acBalance);
0543:
0544:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0545:
0546:                assertEquals("balances to check were all selected? ",
0547:                        new Integer(balancesToCheck.size()), new Integer(
0548:                                orgRevProcess.getBalancesSelected()));
0549:
0550:                List<OriginEntryFull> originEntries = orgRevProcess
0551:                        .getGeneratedOriginEntries();
0552:                logAllEntries(originEntries);
0553:                assertEquals("correct number of origin entries returned? ",
0554:                        new Integer(originEntries.size()), new Integer(2));
0555:
0556:                // check the origin entries
0557:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
0558:                        "13", DEFAULT_BALANCE_CHART,
0559:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
0560:                        new KualiDecimal(-2000));
0561:                assertOriginEntry(
0562:                        originEntries.get(1),
0563:                        previousFiscalYear,
0564:                        "13",
0565:                        DEFAULT_BALANCE_CHART,
0566:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
0567:                        "7900", "RE", "EX", new KualiDecimal(2000));
0568:            }
0569:
0570:            /**
0571:             * Tests that Logic N2 generates the correct origin entries for Scenario 1, budget exceeds actual
0572:             */
0573:            public void testBudgetGreaterThanActualNoEncumbrancesLogicN2() {
0574:                LOG
0575:                        .info("budget greater than actual, no encumbrances test started...");
0576:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0577:
0578:                // add balances to check N2
0579:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO1_CURRENT_BUDGET_BALANCE
0580:                        .convertToBalance();
0581:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
0582:                        .getCode());
0583:                Balance acBalance = BALANCE_FIXTURE.SCENARIO1_ACTUAL_BALANCE
0584:                        .convertToBalance();
0585:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
0586:                        .getCode());
0587:                balancesToCheck.add(cbBalance);
0588:                balancesToCheck.add(acBalance);
0589:
0590:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0591:
0592:                // sanity check - all the balances were selected?
0593:                assertEquals("balances to check were all selected? ",
0594:                        new Integer(balancesToCheck.size()), new Integer(
0595:                                orgRevProcess.getBalancesSelected()));
0596:
0597:                List<OriginEntryFull> originEntries = orgRevProcess
0598:                        .getGeneratedOriginEntries();
0599:                logAllEntries(originEntries);
0600:                assertEquals("correct number of origin entries returned? ",
0601:                        new Integer(originEntries.size()), new Integer(2));
0602:
0603:                // check the origin entries
0604:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
0605:                        "13", DEFAULT_BALANCE_CHART,
0606:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
0607:                        new KualiDecimal(-2000));
0608:                assertOriginEntry(
0609:                        originEntries.get(1),
0610:                        previousFiscalYear,
0611:                        "13",
0612:                        DEFAULT_BALANCE_CHART,
0613:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
0614:                        "7900", "RE", "EX", new KualiDecimal(2000));
0615:            }
0616:
0617:            /**
0618:             * Tests that Logic R1 generates the correct origin entries for Scenario 1, budget exceeds actual
0619:             */
0620:            public void testBudgetGreaterThanActualNoEncumbrancesLogicR1() {
0621:                LOG
0622:                        .info("budget greater than actual, no encumbrances test started...");
0623:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0624:
0625:                // add balances to check R1
0626:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO1_CURRENT_BUDGET_BALANCE
0627:                        .convertToBalance();
0628:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
0629:                        .getCode());
0630:                Balance acBalance = BALANCE_FIXTURE.SCENARIO1_ACTUAL_BALANCE
0631:                        .convertToBalance();
0632:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
0633:                        .getCode());
0634:                balancesToCheck.add(cbBalance);
0635:                balancesToCheck.add(acBalance);
0636:
0637:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0638:
0639:                assertEquals("balances to check were all selected? ",
0640:                        new Integer(balancesToCheck.size()), new Integer(
0641:                                orgRevProcess.getBalancesSelected()));
0642:
0643:                List<OriginEntryFull> originEntries = orgRevProcess
0644:                        .getGeneratedOriginEntries();
0645:                logAllEntries(originEntries);
0646:                assertEquals("correct number of origin entries returned? ",
0647:                        new Integer(originEntries.size()), new Integer(2));
0648:
0649:                // check the origin entries
0650:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
0651:                        "13", DEFAULT_BALANCE_CHART,
0652:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
0653:                        new KualiDecimal(-2000));
0654:                assertOriginEntry(
0655:                        originEntries.get(1),
0656:                        previousFiscalYear,
0657:                        "13",
0658:                        DEFAULT_BALANCE_CHART,
0659:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
0660:                        "7900", "RE", "EX", new KualiDecimal(2000));
0661:            }
0662:
0663:            /**
0664:             * Tests that Logic R2 generates the correct origin entries for Scenario 1, budget exceeds actual
0665:             */
0666:            public void testBudgetGreaterThanActualNoEncumbrancesLogicR2() {
0667:                LOG
0668:                        .info("budget greater than actual, no encumbrances test started...");
0669:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0670:
0671:                // add balances to check R2
0672:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO1_CURRENT_BUDGET_BALANCE
0673:                        .convertToBalance();
0674:                cbBalance
0675:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
0676:                                .getCode());
0677:                Balance acBalance = BALANCE_FIXTURE.SCENARIO1_ACTUAL_BALANCE
0678:                        .convertToBalance();
0679:                acBalance
0680:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
0681:                                .getCode());
0682:                balancesToCheck.add(cbBalance);
0683:                balancesToCheck.add(acBalance);
0684:
0685:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0686:
0687:                assertEquals("balances to check were all selected? ",
0688:                        new Integer(balancesToCheck.size()), new Integer(
0689:                                orgRevProcess.getBalancesSelected()));
0690:
0691:                List<OriginEntryFull> originEntries = orgRevProcess
0692:                        .getGeneratedOriginEntries();
0693:                logAllEntries(originEntries);
0694:                assertEquals("correct number of origin entries returned? ",
0695:                        new Integer(originEntries.size()), new Integer(2));
0696:
0697:                // check the origin entries
0698:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
0699:                        "13", DEFAULT_BALANCE_CHART,
0700:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
0701:                        new KualiDecimal(-2000));
0702:                assertOriginEntry(
0703:                        originEntries.get(1),
0704:                        previousFiscalYear,
0705:                        "13",
0706:                        DEFAULT_BALANCE_CHART,
0707:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
0708:                        "7900", "RE", "EX", new KualiDecimal(2000));
0709:            }
0710:
0711:            /*
0712:             * ************** SCENARIO 2 *****************
0713:             */
0714:            /**
0715:             * Tests that Logic A generates the correct origin entries for Scenario 2, actual exceeds budget
0716:             */
0717:            public void testBudgetLessThanActualNoEncumbrancesALogic() {
0718:                LOG
0719:                        .info("actual greater than budget, no encumbrances test started...");
0720:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0721:
0722:                // add balances to check A
0723:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO2_CURRENT_BUDGET_BALANCE
0724:                        .convertToBalance();
0725:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
0726:                        .getCode());
0727:                Balance acBalance = BALANCE_FIXTURE.SCENARIO2_ACTUAL_BALANCE
0728:                        .convertToBalance();
0729:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
0730:                        .getCode());
0731:                balancesToCheck.add(cbBalance);
0732:                balancesToCheck.add(acBalance);
0733:
0734:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0735:
0736:                assertEquals("balances to check were all selected? ",
0737:                        new Integer(balancesToCheck.size()), new Integer(
0738:                                orgRevProcess.getBalancesSelected()));
0739:
0740:                List<OriginEntryFull> originEntries = orgRevProcess
0741:                        .getGeneratedOriginEntries();
0742:                logAllEntries(originEntries);
0743:                assertEquals("correct number of origin entries returned? ",
0744:                        new Integer(originEntries.size()), new Integer(2));
0745:
0746:                // check the origin entries
0747:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
0748:                        "01", DEFAULT_BALANCE_CHART,
0749:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
0750:                        new KualiDecimal(-3000));
0751:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
0752:                        "01", DEFAULT_BALANCE_CHART,
0753:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
0754:                        new KualiDecimal(-3000));
0755:            }
0756:
0757:            /**
0758:             * Tests that Logic C1 generates the correct origin entries for Scenario 2, actual exceeds budget
0759:             */
0760:            public void testBudgetLessThanActualNoEncumbrancesC1Logic() {
0761:                LOG
0762:                        .info("actual greater than budget, no encumbrances test started...");
0763:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0764:
0765:                // add balances to check C1
0766:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO2_CURRENT_BUDGET_BALANCE
0767:                        .convertToBalance();
0768:                cbBalance
0769:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
0770:                                .getCode());
0771:                Balance acBalance = BALANCE_FIXTURE.SCENARIO2_ACTUAL_BALANCE
0772:                        .convertToBalance();
0773:                acBalance
0774:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
0775:                                .getCode());
0776:                balancesToCheck.add(cbBalance);
0777:                balancesToCheck.add(acBalance);
0778:
0779:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0780:
0781:                assertEquals("balances to check were all selected? ",
0782:                        new Integer(balancesToCheck.size()), new Integer(
0783:                                orgRevProcess.getBalancesSelected()));
0784:
0785:                List<OriginEntryFull> originEntries = orgRevProcess
0786:                        .getGeneratedOriginEntries();
0787:                logAllEntries(originEntries);
0788:                assertEquals("correct number of origin entries returned? ",
0789:                        new Integer(originEntries.size()), new Integer(2));
0790:
0791:                // check the origin entries
0792:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
0793:                        "13", DEFAULT_BALANCE_CHART,
0794:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
0795:                        new KualiDecimal(3000));
0796:                assertOriginEntry(
0797:                        originEntries.get(1),
0798:                        previousFiscalYear,
0799:                        "13",
0800:                        DEFAULT_BALANCE_CHART,
0801:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
0802:                        "7900", "RE", "EX", new KualiDecimal(-3000));
0803:            }
0804:
0805:            /**
0806:             * Tests that Logic C2 generates the correct origin entries for Scenario 2, actual exceeds budget
0807:             */
0808:            public void testBudgetLessThanActualNoEncumbrancesC2Logic() {
0809:                LOG
0810:                        .info("actual greater than budget, no encumbrances test started...");
0811:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0812:
0813:                // add balances to check C2
0814:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO2_CURRENT_BUDGET_BALANCE
0815:                        .convertToBalance();
0816:                cbBalance
0817:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
0818:                                .getCode());
0819:                Balance acBalance = BALANCE_FIXTURE.SCENARIO2_ACTUAL_BALANCE
0820:                        .convertToBalance();
0821:                acBalance
0822:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
0823:                                .getCode());
0824:                balancesToCheck.add(cbBalance);
0825:                balancesToCheck.add(acBalance);
0826:
0827:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0828:
0829:                assertEquals("balances to check were all selected? ",
0830:                        new Integer(balancesToCheck.size()), new Integer(
0831:                                orgRevProcess.getBalancesSelected()));
0832:
0833:                List<OriginEntryFull> originEntries = orgRevProcess
0834:                        .getGeneratedOriginEntries();
0835:                logAllEntries(originEntries);
0836:                assertEquals("correct number of origin entries returned? ",
0837:                        new Integer(originEntries.size()), new Integer(2));
0838:
0839:                // check the origin entries
0840:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
0841:                        "13", DEFAULT_BALANCE_CHART,
0842:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
0843:                        new KualiDecimal(3000));
0844:                assertOriginEntry(
0845:                        originEntries.get(1),
0846:                        previousFiscalYear,
0847:                        "13",
0848:                        DEFAULT_BALANCE_CHART,
0849:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
0850:                        "7900", "RE", "EX", new KualiDecimal(-3000));
0851:            }
0852:
0853:            /**
0854:             * Tests that Logic N1 generates the correct origin entries for Scenario 2, actual exceeds budget
0855:             */
0856:            public void testBudgetLessThanActualNoEncumbrancesN1Logic() {
0857:                LOG
0858:                        .info("actual greater than budget, no encumbrances test started...");
0859:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0860:
0861:                // add balances to check N1
0862:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO2_CURRENT_BUDGET_BALANCE
0863:                        .convertToBalance();
0864:                cbBalance
0865:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
0866:                                .getCode());
0867:                Balance acBalance = BALANCE_FIXTURE.SCENARIO2_ACTUAL_BALANCE
0868:                        .convertToBalance();
0869:                acBalance
0870:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
0871:                                .getCode());
0872:                balancesToCheck.add(cbBalance);
0873:                balancesToCheck.add(acBalance);
0874:
0875:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0876:
0877:                assertEquals("balances to check were all selected? ",
0878:                        new Integer(balancesToCheck.size()), new Integer(
0879:                                orgRevProcess.getBalancesSelected()));
0880:
0881:                List<OriginEntryFull> originEntries = orgRevProcess
0882:                        .getGeneratedOriginEntries();
0883:                logAllEntries(originEntries);
0884:                assertEquals("correct number of origin entries returned? ",
0885:                        new Integer(originEntries.size()), new Integer(2));
0886:
0887:                // check the origin entries
0888:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
0889:                        "01", DEFAULT_BALANCE_CHART,
0890:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
0891:                        new KualiDecimal(-3000));
0892:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
0893:                        "01", DEFAULT_BALANCE_CHART, "1031400", "5000", "CB",
0894:                        "EX", new KualiDecimal(-3000));
0895:            }
0896:
0897:            /**
0898:             * Tests that Logic N2 generates the correct origin entries for Scenario 2, actual exceeds budget
0899:             */
0900:            public void testBudgetLessThanActualNoEncumbrancesN2Logic() {
0901:                LOG
0902:                        .info("actual greater than budget, no encumbrances test started...");
0903:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0904:
0905:                // add balances to check N2
0906:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO2_CURRENT_BUDGET_BALANCE
0907:                        .convertToBalance();
0908:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
0909:                        .getCode());
0910:                Balance acBalance = BALANCE_FIXTURE.SCENARIO2_ACTUAL_BALANCE
0911:                        .convertToBalance();
0912:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
0913:                        .getCode());
0914:                balancesToCheck.add(cbBalance);
0915:                balancesToCheck.add(acBalance);
0916:
0917:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0918:
0919:                assertEquals("balances to check were all selected? ",
0920:                        new Integer(balancesToCheck.size()), new Integer(
0921:                                orgRevProcess.getBalancesSelected()));
0922:
0923:                List<OriginEntryFull> originEntries = orgRevProcess
0924:                        .getGeneratedOriginEntries();
0925:                logAllEntries(originEntries);
0926:                assertEquals("correct number of origin entries returned? ",
0927:                        new Integer(originEntries.size()), new Integer(2));
0928:
0929:                // check the origin entries
0930:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
0931:                        "01", DEFAULT_BALANCE_CHART,
0932:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
0933:                        new KualiDecimal(-3000));
0934:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
0935:                        "01", DEFAULT_BALANCE_CHART,
0936:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
0937:                        new KualiDecimal(-3000));
0938:            }
0939:
0940:            /**
0941:             * Tests that Logic R1 generates the correct origin entries for Scenario 2, actual exceeds budget
0942:             */
0943:            public void testBudgetLessThanActualNoEncumbrancesR1Logic() {
0944:                LOG
0945:                        .info("actual greater than budget, no encumbrances test started...");
0946:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0947:
0948:                // add balances to check R1
0949:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO2_CURRENT_BUDGET_BALANCE
0950:                        .convertToBalance();
0951:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
0952:                        .getCode());
0953:                Balance acBalance = BALANCE_FIXTURE.SCENARIO2_ACTUAL_BALANCE
0954:                        .convertToBalance();
0955:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
0956:                        .getCode());
0957:                balancesToCheck.add(cbBalance);
0958:                balancesToCheck.add(acBalance);
0959:
0960:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
0961:
0962:                assertEquals("balances to check were all selected? ",
0963:                        new Integer(balancesToCheck.size()), new Integer(
0964:                                orgRevProcess.getBalancesSelected()));
0965:
0966:                List<OriginEntryFull> originEntries = orgRevProcess
0967:                        .getGeneratedOriginEntries();
0968:                logAllEntries(originEntries);
0969:                assertEquals("correct number of origin entries returned? ",
0970:                        new Integer(originEntries.size()), new Integer(2));
0971:
0972:                // check the origin entries
0973:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
0974:                        "13", DEFAULT_BALANCE_CHART,
0975:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
0976:                        new KualiDecimal(3000));
0977:                assertOriginEntry(
0978:                        originEntries.get(1),
0979:                        previousFiscalYear,
0980:                        "13",
0981:                        DEFAULT_BALANCE_CHART,
0982:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
0983:                        "7900", "RE", "EX", new KualiDecimal(-3000));
0984:            }
0985:
0986:            /**
0987:             * Tests that Logic R2 generates the correct origin entries for Scenario 2, actual exceeds budget
0988:             */
0989:            public void testBudgetLessThanActualNoEncumbrancesR2Logic() {
0990:                LOG
0991:                        .info("actual greater than budget, no encumbrances test started...");
0992:                List<Balance> balancesToCheck = new ArrayList<Balance>();
0993:
0994:                // add balances to check R2
0995:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO2_CURRENT_BUDGET_BALANCE
0996:                        .convertToBalance();
0997:                cbBalance
0998:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
0999:                                .getCode());
1000:                Balance acBalance = BALANCE_FIXTURE.SCENARIO2_ACTUAL_BALANCE
1001:                        .convertToBalance();
1002:                acBalance
1003:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
1004:                                .getCode());
1005:                balancesToCheck.add(cbBalance);
1006:                balancesToCheck.add(acBalance);
1007:
1008:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1009:
1010:                assertEquals("balances to check were all selected? ",
1011:                        new Integer(balancesToCheck.size()), new Integer(
1012:                                orgRevProcess.getBalancesSelected()));
1013:
1014:                List<OriginEntryFull> originEntries = orgRevProcess
1015:                        .getGeneratedOriginEntries();
1016:                logAllEntries(originEntries);
1017:                assertEquals("correct number of origin entries returned? ",
1018:                        new Integer(originEntries.size()), new Integer(2));
1019:
1020:                // check the origin entries
1021:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
1022:                        "13", DEFAULT_BALANCE_CHART,
1023:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
1024:                        new KualiDecimal(3000));
1025:                assertOriginEntry(
1026:                        originEntries.get(1),
1027:                        previousFiscalYear,
1028:                        "13",
1029:                        DEFAULT_BALANCE_CHART,
1030:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
1031:                        "7900", "RE", "EX", new KualiDecimal(-3000));
1032:            }
1033:
1034:            /*
1035:             * ************** SCENARIO 3 *****************
1036:             */
1037:            /**
1038:             * Tests that Logic A generates the correct origin entries for Scenario 3, budget equals actual
1039:             */
1040:            public void testBudgetEqualsActualNoEncumbrancesALogic() {
1041:                LOG
1042:                        .info("budget equals actual, no encumbrances test started...");
1043:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1044:
1045:                // add balances to check A
1046:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO3_CURRENT_BUDGET_BALANCE
1047:                        .convertToBalance();
1048:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
1049:                        .getCode());
1050:                Balance acBalance = BALANCE_FIXTURE.SCENARIO3_ACTUAL_BALANCE
1051:                        .convertToBalance();
1052:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
1053:                        .getCode());
1054:                balancesToCheck.add(cbBalance);
1055:                balancesToCheck.add(acBalance);
1056:
1057:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1058:
1059:                assertEquals("balances to check were all selected? ",
1060:                        new Integer(balancesToCheck.size()), new Integer(
1061:                                orgRevProcess.getBalancesSelected()));
1062:
1063:                List<OriginEntryFull> originEntries = orgRevProcess
1064:                        .getGeneratedOriginEntries();
1065:                logAllEntries(originEntries);
1066:                assertEquals("correct number of origin entries returned? ",
1067:                        new Integer(originEntries.size()), new Integer(0));
1068:            }
1069:
1070:            /**
1071:             * Tests that Logic C1 generates the correct origin entries for Scenario 3, budget equals actual
1072:             */
1073:            public void testBudgetEqualsActualNoEncumbrancesC1Logic() {
1074:                LOG
1075:                        .info("budget equals actual, no encumbrances test started...");
1076:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1077:
1078:                // add balances to check C1
1079:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO3_CURRENT_BUDGET_BALANCE
1080:                        .convertToBalance();
1081:                cbBalance
1082:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
1083:                                .getCode());
1084:                Balance acBalance = BALANCE_FIXTURE.SCENARIO3_ACTUAL_BALANCE
1085:                        .convertToBalance();
1086:                acBalance
1087:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
1088:                                .getCode());
1089:                balancesToCheck.add(cbBalance);
1090:                balancesToCheck.add(acBalance);
1091:
1092:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1093:
1094:                assertEquals("balances to check were all selected? ",
1095:                        new Integer(balancesToCheck.size()), new Integer(
1096:                                orgRevProcess.getBalancesSelected()));
1097:
1098:                List<OriginEntryFull> originEntries = orgRevProcess
1099:                        .getGeneratedOriginEntries();
1100:                logAllEntries(originEntries);
1101:                assertEquals("correct number of origin entries returned? ",
1102:                        new Integer(originEntries.size()), new Integer(0));
1103:            }
1104:
1105:            /**
1106:             * Tests that Logic C2 generates the correct origin entries for Scenario 3, budget equals actual
1107:             */
1108:            public void testBudgetEqualsActualNoEncumbrancesC2Logic() {
1109:                LOG
1110:                        .info("budget equals actual, no encumbrances test started...");
1111:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1112:
1113:                // add balances to check C2
1114:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO3_CURRENT_BUDGET_BALANCE
1115:                        .convertToBalance();
1116:                cbBalance
1117:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
1118:                                .getCode());
1119:                Balance acBalance = BALANCE_FIXTURE.SCENARIO3_ACTUAL_BALANCE
1120:                        .convertToBalance();
1121:                acBalance
1122:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
1123:                                .getCode());
1124:                balancesToCheck.add(cbBalance);
1125:                balancesToCheck.add(acBalance);
1126:
1127:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1128:
1129:                assertEquals("balances to check were all selected? ",
1130:                        new Integer(balancesToCheck.size()), new Integer(
1131:                                orgRevProcess.getBalancesSelected()));
1132:
1133:                List<OriginEntryFull> originEntries = orgRevProcess
1134:                        .getGeneratedOriginEntries();
1135:                logAllEntries(originEntries);
1136:                assertEquals("correct number of origin entries returned? ",
1137:                        new Integer(originEntries.size()), new Integer(0));
1138:            }
1139:
1140:            /**
1141:             * Tests that Logic N1 generates the correct origin entries for Scenario 3, budget equals actual
1142:             */
1143:            public void testBudgetEqualsActualNoEncumbrancesN1Logic() {
1144:                LOG
1145:                        .info("budget equals actual, no encumbrances test started...");
1146:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1147:
1148:                // add balances to check N1
1149:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO3_CURRENT_BUDGET_BALANCE
1150:                        .convertToBalance();
1151:                cbBalance
1152:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
1153:                                .getCode());
1154:                Balance acBalance = BALANCE_FIXTURE.SCENARIO3_ACTUAL_BALANCE
1155:                        .convertToBalance();
1156:                acBalance
1157:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
1158:                                .getCode());
1159:                balancesToCheck.add(cbBalance);
1160:                balancesToCheck.add(acBalance);
1161:
1162:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1163:
1164:                assertEquals("balances to check were all selected? ",
1165:                        new Integer(balancesToCheck.size()), new Integer(
1166:                                orgRevProcess.getBalancesSelected()));
1167:
1168:                List<OriginEntryFull> originEntries = orgRevProcess
1169:                        .getGeneratedOriginEntries();
1170:                logAllEntries(originEntries);
1171:                assertEquals("correct number of origin entries returned? ",
1172:                        new Integer(originEntries.size()), new Integer(0));
1173:            }
1174:
1175:            /**
1176:             * Tests that Logic N2 generates the correct origin entries for Scenario 3, budget equals actual
1177:             */
1178:            public void testBudgetEqualsActualNoEncumbrancesN2Logic() {
1179:                LOG
1180:                        .info("budget equals actual, no encumbrances test started...");
1181:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1182:
1183:                // add balances to check N2
1184:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO3_CURRENT_BUDGET_BALANCE
1185:                        .convertToBalance();
1186:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
1187:                        .getCode());
1188:                Balance acBalance = BALANCE_FIXTURE.SCENARIO3_ACTUAL_BALANCE
1189:                        .convertToBalance();
1190:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
1191:                        .getCode());
1192:                balancesToCheck.add(cbBalance);
1193:                balancesToCheck.add(acBalance);
1194:
1195:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1196:
1197:                assertEquals("balances to check were all selected? ",
1198:                        new Integer(balancesToCheck.size()), new Integer(
1199:                                orgRevProcess.getBalancesSelected()));
1200:
1201:                List<OriginEntryFull> originEntries = orgRevProcess
1202:                        .getGeneratedOriginEntries();
1203:                logAllEntries(originEntries);
1204:                assertEquals("correct number of origin entries returned? ",
1205:                        new Integer(originEntries.size()), new Integer(0));
1206:            }
1207:
1208:            /**
1209:             * Tests that Logic R1 generates the correct origin entries for Scenario 3, budget equals actual
1210:             */
1211:            public void testBudgetEqualsActualNoEncumbrancesR1Logic() {
1212:                LOG
1213:                        .info("budget equals actual, no encumbrances test started...");
1214:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1215:
1216:                // add balances to check R1
1217:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO3_CURRENT_BUDGET_BALANCE
1218:                        .convertToBalance();
1219:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
1220:                        .getCode());
1221:                Balance acBalance = BALANCE_FIXTURE.SCENARIO3_ACTUAL_BALANCE
1222:                        .convertToBalance();
1223:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
1224:                        .getCode());
1225:                balancesToCheck.add(cbBalance);
1226:                balancesToCheck.add(acBalance);
1227:
1228:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1229:
1230:                assertEquals("balances to check were all selected? ",
1231:                        new Integer(balancesToCheck.size()), new Integer(
1232:                                orgRevProcess.getBalancesSelected()));
1233:
1234:                List<OriginEntryFull> originEntries = orgRevProcess
1235:                        .getGeneratedOriginEntries();
1236:                logAllEntries(originEntries);
1237:                assertEquals("correct number of origin entries returned? ",
1238:                        new Integer(originEntries.size()), new Integer(0));
1239:            }
1240:
1241:            /**
1242:             * Tests that Logic R2 generates the correct origin entries for Scenario 3, budget equals actual
1243:             */
1244:            public void testBudgetEqualsActualNoEncumbrancesR2Logic() {
1245:                LOG
1246:                        .info("budget equals actual, no encumbrances test started...");
1247:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1248:
1249:                // add balances to check R2
1250:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO3_CURRENT_BUDGET_BALANCE
1251:                        .convertToBalance();
1252:                cbBalance
1253:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
1254:                                .getCode());
1255:                Balance acBalance = BALANCE_FIXTURE.SCENARIO3_ACTUAL_BALANCE
1256:                        .convertToBalance();
1257:                acBalance
1258:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
1259:                                .getCode());
1260:                balancesToCheck.add(cbBalance);
1261:                balancesToCheck.add(acBalance);
1262:
1263:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1264:
1265:                assertEquals("balances to check were all selected? ",
1266:                        new Integer(balancesToCheck.size()), new Integer(
1267:                                orgRevProcess.getBalancesSelected()));
1268:
1269:                List<OriginEntryFull> originEntries = orgRevProcess
1270:                        .getGeneratedOriginEntries();
1271:                logAllEntries(originEntries);
1272:                assertEquals("correct number of origin entries returned? ",
1273:                        new Integer(originEntries.size()), new Integer(0));
1274:            }
1275:
1276:            /*
1277:             * ************** SCENARIO 4 *****************
1278:             */
1279:            /**
1280:             * Tests that Logic A generates the correct origin entries for Scenario 4, budget exceeds actual + encumbrance
1281:             */
1282:            public void testBudgetGreaterThanActualVarianceGreaterThanEncumbrancesLogicA() {
1283:                LOG
1284:                        .info("budget greater than actual, variance greater than encumbrances test started...");
1285:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1286:
1287:                // add balances to check A
1288:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO4_CURRENT_BUDGET_BALANCE
1289:                        .convertToBalance();
1290:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
1291:                        .getCode());
1292:                Balance acBalance = BALANCE_FIXTURE.SCENARIO4_ACTUAL_BALANCE
1293:                        .convertToBalance();
1294:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
1295:                        .getCode());
1296:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO4_ENCUMBRANCE_BALANCE
1297:                        .convertToBalance();
1298:                encumbranceBalance
1299:                        .setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
1300:                                .getCode());
1301:                balancesToCheck.add(cbBalance);
1302:                balancesToCheck.add(acBalance);
1303:                balancesToCheck.add(encumbranceBalance);
1304:
1305:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1306:
1307:                // sanity check - all the balances were selected?
1308:                assertEquals("balances to check were all selected? ",
1309:                        new Integer(balancesToCheck.size()), new Integer(
1310:                                orgRevProcess.getBalancesSelected()));
1311:
1312:                List<OriginEntryFull> originEntries = orgRevProcess
1313:                        .getGeneratedOriginEntries();
1314:                logAllEntries(originEntries);
1315:
1316:                assertEquals("correct number of origin entries returned? ",
1317:                        new Integer(originEntries.size()), new Integer(2));
1318:
1319:                // check the origin entries
1320:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
1321:                        "01", DEFAULT_BALANCE_CHART,
1322:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
1323:                        new KualiDecimal(2000));
1324:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
1325:                        "01", DEFAULT_BALANCE_CHART,
1326:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
1327:                        new KualiDecimal(2000));
1328:            }
1329:
1330:            /**
1331:             * Tests that Logic C1 generates the correct origin entries for Scenario 4, budget exceeds actual + encumbrance
1332:             */
1333:            public void testBudgetGreaterThanActualVarianceGreaterThanEncumbrancesLogicC1() {
1334:                LOG
1335:                        .info("budget greater than actual, variance greater than encumbrances test started...");
1336:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1337:
1338:                // add balances to check C1
1339:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO4_CURRENT_BUDGET_BALANCE
1340:                        .convertToBalance();
1341:                cbBalance
1342:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
1343:                                .getCode());
1344:                Balance acBalance = BALANCE_FIXTURE.SCENARIO4_ACTUAL_BALANCE
1345:                        .convertToBalance();
1346:                acBalance
1347:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
1348:                                .getCode());
1349:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO4_ENCUMBRANCE_BALANCE
1350:                        .convertToBalance();
1351:                encumbranceBalance
1352:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
1353:                                .getCode());
1354:                balancesToCheck.add(cbBalance);
1355:                balancesToCheck.add(acBalance);
1356:                balancesToCheck.add(encumbranceBalance);
1357:
1358:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1359:
1360:                // sanity check - all the balances were selected?
1361:                assertEquals("balances to check were all selected? ",
1362:                        new Integer(balancesToCheck.size()), new Integer(
1363:                                orgRevProcess.getBalancesSelected()));
1364:
1365:                List<OriginEntryFull> originEntries = orgRevProcess
1366:                        .getGeneratedOriginEntries();
1367:                logAllEntries(originEntries);
1368:
1369:                assertEquals("correct number of origin entries returned? ",
1370:                        new Integer(originEntries.size()), new Integer(2));
1371:
1372:                // check the origin entries
1373:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
1374:                        "01", DEFAULT_BALANCE_CHART,
1375:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
1376:                        new KualiDecimal(2000));
1377:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
1378:                        "01", DEFAULT_BALANCE_CHART,
1379:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
1380:                        new KualiDecimal(2000));
1381:            }
1382:
1383:            /**
1384:             * Tests that Logic C2 generates the correct origin entries for Scenario 4, budget exceeds actual + encumbrance
1385:             */
1386:            public void testBudgetGreaterThanActualVarianceGreaterThanEncumbrancesLogicC2() {
1387:                LOG
1388:                        .info("budget greater than actual, variance greater than encumbrances test started...");
1389:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1390:
1391:                // add balances to check C2
1392:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO4_CURRENT_BUDGET_BALANCE
1393:                        .convertToBalance();
1394:                cbBalance
1395:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
1396:                                .getCode());
1397:                Balance acBalance = BALANCE_FIXTURE.SCENARIO4_ACTUAL_BALANCE
1398:                        .convertToBalance();
1399:                acBalance
1400:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
1401:                                .getCode());
1402:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO4_ENCUMBRANCE_BALANCE
1403:                        .convertToBalance();
1404:                encumbranceBalance
1405:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
1406:                                .getCode());
1407:                balancesToCheck.add(cbBalance);
1408:                balancesToCheck.add(acBalance);
1409:                balancesToCheck.add(encumbranceBalance);
1410:
1411:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1412:
1413:                // sanity check - all the balances were selected?
1414:                assertEquals("balances to check were all selected? ",
1415:                        new Integer(balancesToCheck.size()), new Integer(
1416:                                orgRevProcess.getBalancesSelected()));
1417:
1418:                List<OriginEntryFull> originEntries = orgRevProcess
1419:                        .getGeneratedOriginEntries();
1420:                logAllEntries(originEntries);
1421:
1422:                assertEquals("correct number of origin entries returned? ",
1423:                        new Integer(originEntries.size()), new Integer(2));
1424:
1425:                // check the origin entries
1426:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
1427:                        "01", DEFAULT_BALANCE_CHART,
1428:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
1429:                        new KualiDecimal(2000));
1430:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
1431:                        "01", DEFAULT_BALANCE_CHART,
1432:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
1433:                        new KualiDecimal(2000));
1434:            }
1435:
1436:            /**
1437:             * Tests that Logic N1 generates the correct origin entries for Scenario 4, budget exceeds actual + encumbrance
1438:             */
1439:            public void testBudgetGreaterThanActualVarianceGreaterThanEncumbrancesLogicN1() {
1440:                LOG
1441:                        .info("budget greater than actual, variance greater than encumbrances test started...");
1442:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1443:
1444:                // add balances to check N1
1445:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO4_CURRENT_BUDGET_BALANCE
1446:                        .convertToBalance();
1447:                cbBalance
1448:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
1449:                                .getCode());
1450:                Balance acBalance = BALANCE_FIXTURE.SCENARIO4_ACTUAL_BALANCE
1451:                        .convertToBalance();
1452:                acBalance
1453:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
1454:                                .getCode());
1455:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO4_ENCUMBRANCE_BALANCE
1456:                        .convertToBalance();
1457:                encumbranceBalance
1458:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
1459:                                .getCode());
1460:                balancesToCheck.add(cbBalance);
1461:                balancesToCheck.add(acBalance);
1462:                balancesToCheck.add(encumbranceBalance);
1463:
1464:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1465:
1466:                // sanity check - all the balances were selected?
1467:                assertEquals("balances to check were all selected? ",
1468:                        new Integer(balancesToCheck.size()), new Integer(
1469:                                orgRevProcess.getBalancesSelected()));
1470:
1471:                List<OriginEntryFull> originEntries = orgRevProcess
1472:                        .getGeneratedOriginEntries();
1473:                logAllEntries(originEntries);
1474:
1475:                assertEquals("correct number of origin entries returned? ",
1476:                        new Integer(originEntries.size()), new Integer(4));
1477:
1478:                // check the origin entries
1479:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
1480:                        "13", DEFAULT_BALANCE_CHART,
1481:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
1482:                        new KualiDecimal(-1500));
1483:                assertOriginEntry(
1484:                        originEntries.get(1),
1485:                        previousFiscalYear,
1486:                        "13",
1487:                        DEFAULT_BALANCE_CHART,
1488:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
1489:                        "7900", "RE", "EX", new KualiDecimal(1500));
1490:                assertOriginEntry(originEntries.get(2), currentFiscalYear,
1491:                        "01", DEFAULT_BALANCE_CHART,
1492:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
1493:                        new KualiDecimal(500));
1494:                assertOriginEntry(originEntries.get(3), currentFiscalYear,
1495:                        "01", DEFAULT_BALANCE_CHART,
1496:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
1497:                        new KualiDecimal(500));
1498:            }
1499:
1500:            /**
1501:             * Tests that Logic N2 generates the correct origin entries for Scenario 4, budget exceeds actual + encumbrance
1502:             */
1503:            public void testBudgetGreaterThanActualVarianceGreaterThanEncumbrancesLogicN2() {
1504:                LOG
1505:                        .info("budget greater than actual, variance greater than encumbrances test started...");
1506:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1507:
1508:                // add balances to check N2
1509:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO4_CURRENT_BUDGET_BALANCE
1510:                        .convertToBalance();
1511:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
1512:                        .getCode());
1513:                Balance acBalance = BALANCE_FIXTURE.SCENARIO4_ACTUAL_BALANCE
1514:                        .convertToBalance();
1515:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
1516:                        .getCode());
1517:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO4_ENCUMBRANCE_BALANCE
1518:                        .convertToBalance();
1519:                encumbranceBalance
1520:                        .setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
1521:                                .getCode());
1522:                balancesToCheck.add(cbBalance);
1523:                balancesToCheck.add(acBalance);
1524:                balancesToCheck.add(encumbranceBalance);
1525:
1526:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1527:
1528:                // sanity check - all the balances were selected?
1529:                assertEquals("balances to check were all selected? ",
1530:                        new Integer(balancesToCheck.size()), new Integer(
1531:                                orgRevProcess.getBalancesSelected()));
1532:
1533:                List<OriginEntryFull> originEntries = orgRevProcess
1534:                        .getGeneratedOriginEntries();
1535:                logAllEntries(originEntries);
1536:
1537:                assertEquals("correct number of origin entries returned? ",
1538:                        new Integer(originEntries.size()), new Integer(2));
1539:
1540:                // check the origin entries
1541:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
1542:                        "13", DEFAULT_BALANCE_CHART,
1543:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
1544:                        new KualiDecimal(-2000));
1545:                assertOriginEntry(
1546:                        originEntries.get(1),
1547:                        previousFiscalYear,
1548:                        "13",
1549:                        DEFAULT_BALANCE_CHART,
1550:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
1551:                        "7900", "RE", "EX", new KualiDecimal(2000));
1552:            }
1553:
1554:            /**
1555:             * Tests that Logic R1 generates the correct origin entries for Scenario 4, budget exceeds actual + encumbrance
1556:             */
1557:            public void testBudgetGreaterThanActualVarianceGreaterThanEncumbrancesLogicR1() {
1558:                LOG
1559:                        .info("budget greater than actual, variance greater than encumbrances test started...");
1560:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1561:
1562:                // add balances to check R1
1563:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO4_CURRENT_BUDGET_BALANCE
1564:                        .convertToBalance();
1565:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
1566:                        .getCode());
1567:                Balance acBalance = BALANCE_FIXTURE.SCENARIO4_ACTUAL_BALANCE
1568:                        .convertToBalance();
1569:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
1570:                        .getCode());
1571:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO4_ENCUMBRANCE_BALANCE
1572:                        .convertToBalance();
1573:                encumbranceBalance
1574:                        .setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
1575:                                .getCode());
1576:                balancesToCheck.add(cbBalance);
1577:                balancesToCheck.add(acBalance);
1578:                balancesToCheck.add(encumbranceBalance);
1579:
1580:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1581:
1582:                // sanity check - all the balances were selected?
1583:                assertEquals("balances to check were all selected? ",
1584:                        new Integer(balancesToCheck.size()), new Integer(
1585:                                orgRevProcess.getBalancesSelected()));
1586:
1587:                List<OriginEntryFull> originEntries = orgRevProcess
1588:                        .getGeneratedOriginEntries();
1589:                logAllEntries(originEntries);
1590:
1591:                assertEquals("correct number of origin entries returned? ",
1592:                        new Integer(originEntries.size()), new Integer(4));
1593:
1594:                // check the origin entries
1595:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
1596:                        "13", DEFAULT_BALANCE_CHART,
1597:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
1598:                        new KualiDecimal(-1500));
1599:                assertOriginEntry(
1600:                        originEntries.get(1),
1601:                        previousFiscalYear,
1602:                        "13",
1603:                        DEFAULT_BALANCE_CHART,
1604:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
1605:                        "7900", "RE", "EX", new KualiDecimal(1500));
1606:                assertOriginEntry(originEntries.get(2), currentFiscalYear,
1607:                        "01", DEFAULT_BALANCE_CHART,
1608:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
1609:                        new KualiDecimal(500));
1610:                assertOriginEntry(originEntries.get(3), currentFiscalYear,
1611:                        "01", DEFAULT_BALANCE_CHART,
1612:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
1613:                        new KualiDecimal(500));
1614:            }
1615:
1616:            /**
1617:             * Tests that LogicR2 generates the correct origin entries for Scenario 4, budget exceeds actual + encumbrance
1618:             */
1619:            public void testBudgetGreaterThanActualVarianceGreaterThanEncumbrancesLogicR2() {
1620:                LOG
1621:                        .info("budget greater than actual, variance greater than encumbrances test started...");
1622:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1623:
1624:                // add balances to check R2
1625:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO4_CURRENT_BUDGET_BALANCE
1626:                        .convertToBalance();
1627:                cbBalance
1628:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
1629:                                .getCode());
1630:                Balance acBalance = BALANCE_FIXTURE.SCENARIO4_ACTUAL_BALANCE
1631:                        .convertToBalance();
1632:                acBalance
1633:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
1634:                                .getCode());
1635:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO4_ENCUMBRANCE_BALANCE
1636:                        .convertToBalance();
1637:                encumbranceBalance
1638:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
1639:                                .getCode());
1640:                balancesToCheck.add(cbBalance);
1641:                balancesToCheck.add(acBalance);
1642:                balancesToCheck.add(encumbranceBalance);
1643:
1644:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1645:
1646:                // sanity check - all the balances were selected?
1647:                assertEquals("balances to check were all selected? ",
1648:                        new Integer(balancesToCheck.size()), new Integer(
1649:                                orgRevProcess.getBalancesSelected()));
1650:
1651:                List<OriginEntryFull> originEntries = orgRevProcess
1652:                        .getGeneratedOriginEntries();
1653:                logAllEntries(originEntries);
1654:
1655:                assertEquals("correct number of origin entries returned? ",
1656:                        new Integer(originEntries.size()), new Integer(2));
1657:
1658:                // check the origin entries
1659:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
1660:                        "13", DEFAULT_BALANCE_CHART,
1661:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
1662:                        new KualiDecimal(-2000));
1663:                assertOriginEntry(
1664:                        originEntries.get(1),
1665:                        previousFiscalYear,
1666:                        "13",
1667:                        DEFAULT_BALANCE_CHART,
1668:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
1669:                        "7900", "RE", "EX", new KualiDecimal(2000));
1670:            }
1671:
1672:            /*
1673:             * ************** SCENARIO 5 *****************
1674:             */
1675:            /**
1676:             * Tests that Logic A generates the correct origin entries for Scenario 5, budget equals actual + encumbrance
1677:             */
1678:            public void testBudgetGreaterThanActualVarianceEqualsEncumbrancesLogicA() {
1679:                LOG
1680:                        .info("budget greater than actual, variance equals encumbrances test started...");
1681:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1682:
1683:                // add balances to check A
1684:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO5_CURRENT_BUDGET_BALANCE
1685:                        .convertToBalance();
1686:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
1687:                        .getCode());
1688:                Balance acBalance = BALANCE_FIXTURE.SCENARIO5_ACTUAL_BALANCE
1689:                        .convertToBalance();
1690:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
1691:                        .getCode());
1692:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO5_ENCUMBRANCE_BALANCE
1693:                        .convertToBalance();
1694:                encumbranceBalance
1695:                        .setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
1696:                                .getCode());
1697:                balancesToCheck.add(cbBalance);
1698:                balancesToCheck.add(acBalance);
1699:                balancesToCheck.add(encumbranceBalance);
1700:
1701:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1702:
1703:                // sanity check - all the balances were selected?
1704:                assertEquals("balances to check were all selected? ",
1705:                        new Integer(balancesToCheck.size()), new Integer(
1706:                                orgRevProcess.getBalancesSelected()));
1707:
1708:                List<OriginEntryFull> originEntries = orgRevProcess
1709:                        .getGeneratedOriginEntries();
1710:                logAllEntries(originEntries);
1711:
1712:                assertEquals("correct number of origin entries returned? ",
1713:                        new Integer(originEntries.size()), new Integer(2));
1714:
1715:                // check the origin entries
1716:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
1717:                        "01", DEFAULT_BALANCE_CHART,
1718:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
1719:                        new KualiDecimal(2000));
1720:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
1721:                        "01", DEFAULT_BALANCE_CHART,
1722:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
1723:                        new KualiDecimal(2000));
1724:            }
1725:
1726:            /**
1727:             * Tests that Logic C1 generates the correct origin entries for Scenario 5, budget equals actual + encumbrance
1728:             */
1729:            public void testBudgetGreaterThanActualVarianceEqualsEncumbrancesLogicC1() {
1730:                LOG
1731:                        .info("budget greater than actual, variance equals encumbrances test started...");
1732:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1733:
1734:                // add balances to check C1
1735:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO5_CURRENT_BUDGET_BALANCE
1736:                        .convertToBalance();
1737:                cbBalance
1738:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
1739:                                .getCode());
1740:                Balance acBalance = BALANCE_FIXTURE.SCENARIO5_ACTUAL_BALANCE
1741:                        .convertToBalance();
1742:                acBalance
1743:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
1744:                                .getCode());
1745:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO5_ENCUMBRANCE_BALANCE
1746:                        .convertToBalance();
1747:                encumbranceBalance
1748:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
1749:                                .getCode());
1750:                balancesToCheck.add(cbBalance);
1751:                balancesToCheck.add(acBalance);
1752:                balancesToCheck.add(encumbranceBalance);
1753:
1754:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1755:
1756:                // sanity check - all the balances were selected?
1757:                assertEquals("balances to check were all selected? ",
1758:                        new Integer(balancesToCheck.size()), new Integer(
1759:                                orgRevProcess.getBalancesSelected()));
1760:
1761:                List<OriginEntryFull> originEntries = orgRevProcess
1762:                        .getGeneratedOriginEntries();
1763:                logAllEntries(originEntries);
1764:
1765:                assertEquals("correct number of origin entries returned? ",
1766:                        new Integer(originEntries.size()), new Integer(2));
1767:
1768:                // check the origin entries
1769:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
1770:                        "01", DEFAULT_BALANCE_CHART,
1771:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
1772:                        new KualiDecimal(2000));
1773:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
1774:                        "01", DEFAULT_BALANCE_CHART,
1775:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
1776:                        new KualiDecimal(2000));
1777:            }
1778:
1779:            /**
1780:             * Tests that Logic C2 generates the correct origin entries for Scenario 5, budget equals actual + encumbrance
1781:             */
1782:            public void testBudgetGreaterThanActualVarianceEqualsEncumbrancesLogicC2() {
1783:                LOG
1784:                        .info("budget greater than actual, variance equals encumbrances test started...");
1785:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1786:
1787:                // add balances to check C2
1788:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO5_CURRENT_BUDGET_BALANCE
1789:                        .convertToBalance();
1790:                cbBalance
1791:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
1792:                                .getCode());
1793:                Balance acBalance = BALANCE_FIXTURE.SCENARIO5_ACTUAL_BALANCE
1794:                        .convertToBalance();
1795:                acBalance
1796:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
1797:                                .getCode());
1798:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO5_ENCUMBRANCE_BALANCE
1799:                        .convertToBalance();
1800:                encumbranceBalance
1801:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
1802:                                .getCode());
1803:                balancesToCheck.add(cbBalance);
1804:                balancesToCheck.add(acBalance);
1805:                balancesToCheck.add(encumbranceBalance);
1806:
1807:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1808:
1809:                // sanity check - all the balances were selected?
1810:                assertEquals("balances to check were all selected? ",
1811:                        new Integer(balancesToCheck.size()), new Integer(
1812:                                orgRevProcess.getBalancesSelected()));
1813:
1814:                List<OriginEntryFull> originEntries = orgRevProcess
1815:                        .getGeneratedOriginEntries();
1816:                logAllEntries(originEntries);
1817:
1818:                assertEquals("correct number of origin entries returned? ",
1819:                        new Integer(originEntries.size()), new Integer(2));
1820:
1821:                // check the origin entries
1822:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
1823:                        "01", DEFAULT_BALANCE_CHART,
1824:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
1825:                        new KualiDecimal(2000));
1826:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
1827:                        "01", DEFAULT_BALANCE_CHART,
1828:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
1829:                        new KualiDecimal(2000));
1830:            }
1831:
1832:            /**
1833:             * Tests that Logic N1 generates the correct origin entries for Scenario 5, budget equals actual + encumbrance
1834:             */
1835:            public void testBudgetGreaterThanActualVarianceEqualsEncumbrancesLogicN1() {
1836:                LOG
1837:                        .info("budget greater than actual, variance equals encumbrances test started...");
1838:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1839:
1840:                // add balances to check N1
1841:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO5_CURRENT_BUDGET_BALANCE
1842:                        .convertToBalance();
1843:                cbBalance
1844:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
1845:                                .getCode());
1846:                Balance acBalance = BALANCE_FIXTURE.SCENARIO5_ACTUAL_BALANCE
1847:                        .convertToBalance();
1848:                acBalance
1849:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
1850:                                .getCode());
1851:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO5_ENCUMBRANCE_BALANCE
1852:                        .convertToBalance();
1853:                encumbranceBalance
1854:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
1855:                                .getCode());
1856:                balancesToCheck.add(cbBalance);
1857:                balancesToCheck.add(acBalance);
1858:                balancesToCheck.add(encumbranceBalance);
1859:
1860:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1861:
1862:                // sanity check - all the balances were selected?
1863:                assertEquals("balances to check were all selected? ",
1864:                        new Integer(balancesToCheck.size()), new Integer(
1865:                                orgRevProcess.getBalancesSelected()));
1866:
1867:                List<OriginEntryFull> originEntries = orgRevProcess
1868:                        .getGeneratedOriginEntries();
1869:                logAllEntries(originEntries);
1870:
1871:                assertEquals("correct number of origin entries returned? ",
1872:                        new Integer(originEntries.size()), new Integer(2));
1873:
1874:                // check the origin entries
1875:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
1876:                        "01", DEFAULT_BALANCE_CHART,
1877:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
1878:                        new KualiDecimal(2000));
1879:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
1880:                        "01", DEFAULT_BALANCE_CHART,
1881:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
1882:                        new KualiDecimal(2000));
1883:            }
1884:
1885:            /**
1886:             * Tests that Logic N2 generates the correct origin entries for Scenario 5, budget equals actual + encumbrance
1887:             */
1888:            public void testBudgetGreaterThanActualVarianceEqualsEncumbrancesLogicN2() {
1889:                LOG
1890:                        .info("budget greater than actual, variance equals encumbrances test started...");
1891:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1892:
1893:                // add balances to check N2
1894:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO5_CURRENT_BUDGET_BALANCE
1895:                        .convertToBalance();
1896:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
1897:                        .getCode());
1898:                Balance acBalance = BALANCE_FIXTURE.SCENARIO5_ACTUAL_BALANCE
1899:                        .convertToBalance();
1900:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
1901:                        .getCode());
1902:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO5_ENCUMBRANCE_BALANCE
1903:                        .convertToBalance();
1904:                encumbranceBalance
1905:                        .setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
1906:                                .getCode());
1907:                balancesToCheck.add(cbBalance);
1908:                balancesToCheck.add(acBalance);
1909:                balancesToCheck.add(encumbranceBalance);
1910:
1911:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1912:
1913:                // sanity check - all the balances were selected?
1914:                assertEquals("balances to check were all selected? ",
1915:                        new Integer(balancesToCheck.size()), new Integer(
1916:                                orgRevProcess.getBalancesSelected()));
1917:
1918:                List<OriginEntryFull> originEntries = orgRevProcess
1919:                        .getGeneratedOriginEntries();
1920:                logAllEntries(originEntries);
1921:
1922:                assertEquals("correct number of origin entries returned? ",
1923:                        new Integer(originEntries.size()), new Integer(2));
1924:
1925:                // check the origin entries
1926:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
1927:                        "13", DEFAULT_BALANCE_CHART,
1928:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
1929:                        new KualiDecimal(-2000));
1930:                assertOriginEntry(
1931:                        originEntries.get(1),
1932:                        previousFiscalYear,
1933:                        "13",
1934:                        DEFAULT_BALANCE_CHART,
1935:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
1936:                        "7900", "RE", "EX", new KualiDecimal(2000));
1937:            }
1938:
1939:            /**
1940:             * Tests that Logic R1 generates the correct origin entries for Scenario 5, budget equals actual + encumbrance
1941:             */
1942:            public void testBudgetGreaterThanActualVarianceEqualsEncumbrancesLogicR1() {
1943:                LOG
1944:                        .info("budget greater than actual, variance equals encumbrances test started...");
1945:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1946:
1947:                // add balances to check R1
1948:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO5_CURRENT_BUDGET_BALANCE
1949:                        .convertToBalance();
1950:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
1951:                        .getCode());
1952:                Balance acBalance = BALANCE_FIXTURE.SCENARIO5_ACTUAL_BALANCE
1953:                        .convertToBalance();
1954:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
1955:                        .getCode());
1956:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO5_ENCUMBRANCE_BALANCE
1957:                        .convertToBalance();
1958:                encumbranceBalance
1959:                        .setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
1960:                                .getCode());
1961:                balancesToCheck.add(cbBalance);
1962:                balancesToCheck.add(acBalance);
1963:                balancesToCheck.add(encumbranceBalance);
1964:
1965:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
1966:
1967:                // sanity check - all the balances were selected?
1968:                assertEquals("balances to check were all selected? ",
1969:                        new Integer(balancesToCheck.size()), new Integer(
1970:                                orgRevProcess.getBalancesSelected()));
1971:
1972:                List<OriginEntryFull> originEntries = orgRevProcess
1973:                        .getGeneratedOriginEntries();
1974:                logAllEntries(originEntries);
1975:
1976:                assertEquals("correct number of origin entries returned? ",
1977:                        new Integer(originEntries.size()), new Integer(2));
1978:
1979:                // check the origin entries
1980:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
1981:                        "01", DEFAULT_BALANCE_CHART,
1982:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
1983:                        new KualiDecimal(2000));
1984:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
1985:                        "01", DEFAULT_BALANCE_CHART,
1986:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
1987:                        new KualiDecimal(2000));
1988:            }
1989:
1990:            /**
1991:             * Tests that Logic R2 generates the correct origin entries for Scenario 5, budget equals actual + encumbrance
1992:             */
1993:            public void testBudgetGreaterThanActualVarianceEqualsEncumbrancesLogicR2() {
1994:                LOG
1995:                        .info("budget greater than actual, variance equals encumbrances test started...");
1996:                List<Balance> balancesToCheck = new ArrayList<Balance>();
1997:
1998:                // add balances to check R2
1999:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO5_CURRENT_BUDGET_BALANCE
2000:                        .convertToBalance();
2001:                cbBalance
2002:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
2003:                                .getCode());
2004:                Balance acBalance = BALANCE_FIXTURE.SCENARIO5_ACTUAL_BALANCE
2005:                        .convertToBalance();
2006:                acBalance
2007:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
2008:                                .getCode());
2009:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO5_ENCUMBRANCE_BALANCE
2010:                        .convertToBalance();
2011:                encumbranceBalance
2012:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
2013:                                .getCode());
2014:                balancesToCheck.add(cbBalance);
2015:                balancesToCheck.add(acBalance);
2016:                balancesToCheck.add(encumbranceBalance);
2017:
2018:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2019:
2020:                // sanity check - all the balances were selected?
2021:                assertEquals("balances to check were all selected? ",
2022:                        new Integer(balancesToCheck.size()), new Integer(
2023:                                orgRevProcess.getBalancesSelected()));
2024:
2025:                List<OriginEntryFull> originEntries = orgRevProcess
2026:                        .getGeneratedOriginEntries();
2027:                logAllEntries(originEntries);
2028:
2029:                assertEquals("correct number of origin entries returned? ",
2030:                        new Integer(originEntries.size()), new Integer(2));
2031:
2032:                // check the origin entries
2033:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
2034:                        "13", DEFAULT_BALANCE_CHART,
2035:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
2036:                        new KualiDecimal(-2000));
2037:                assertOriginEntry(
2038:                        originEntries.get(1),
2039:                        previousFiscalYear,
2040:                        "13",
2041:                        DEFAULT_BALANCE_CHART,
2042:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
2043:                        "7900", "RE", "EX", new KualiDecimal(2000));
2044:            }
2045:
2046:            /*
2047:             * ************** SCENARIO 6 *****************
2048:             */
2049:            /**
2050:             * Tests that Logic A generates the correct origin entries for Scenario 6, Actual + encumbrance exceeds budget
2051:             */
2052:            public void testBudgetGreaterThanActualVariancesLessThanEncumbrancesLogicA() {
2053:                LOG
2054:                        .info("budget great than actual, variance less than encumbrances test started...");
2055:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2056:
2057:                // add balances to check A
2058:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO6_CURRENT_BUDGET_BALANCE
2059:                        .convertToBalance();
2060:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
2061:                        .getCode());
2062:                Balance acBalance = BALANCE_FIXTURE.SCENARIO6_ACTUAL_BALANCE
2063:                        .convertToBalance();
2064:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
2065:                        .getCode());
2066:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO6_ENCUMBRANCE_BALANCE
2067:                        .convertToBalance();
2068:                encumbranceBalance
2069:                        .setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
2070:                                .getCode());
2071:                balancesToCheck.add(cbBalance);
2072:                balancesToCheck.add(acBalance);
2073:                balancesToCheck.add(encumbranceBalance);
2074:
2075:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2076:
2077:                // sanity check - all the balances were selected?
2078:                assertEquals("balances to check were all selected? ",
2079:                        new Integer(balancesToCheck.size()), new Integer(
2080:                                orgRevProcess.getBalancesSelected()));
2081:
2082:                List<OriginEntryFull> originEntries = orgRevProcess
2083:                        .getGeneratedOriginEntries();
2084:                logAllEntries(originEntries);
2085:
2086:                assertEquals("correct number of origin entries returned? ",
2087:                        new Integer(originEntries.size()), new Integer(2));
2088:
2089:                // check the origin entries
2090:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
2091:                        "01", DEFAULT_BALANCE_CHART,
2092:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
2093:                        new KualiDecimal(2000));
2094:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
2095:                        "01", DEFAULT_BALANCE_CHART,
2096:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
2097:                        new KualiDecimal(2000));
2098:            }
2099:
2100:            /**
2101:             * Tests that Logic C1 generates the correct origin entries for Scenario 6, Actual + encumbrance exceeds budget
2102:             */
2103:            public void testBudgetGreaterThanActualVariancesLessThanEncumbrancesLogicC1() {
2104:                LOG
2105:                        .info("budget great than actual, variance less than encumbrances test started...");
2106:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2107:
2108:                // add balances to check C1
2109:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO6_CURRENT_BUDGET_BALANCE
2110:                        .convertToBalance();
2111:                cbBalance
2112:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
2113:                                .getCode());
2114:                Balance acBalance = BALANCE_FIXTURE.SCENARIO6_ACTUAL_BALANCE
2115:                        .convertToBalance();
2116:                acBalance
2117:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
2118:                                .getCode());
2119:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO6_ENCUMBRANCE_BALANCE
2120:                        .convertToBalance();
2121:                encumbranceBalance
2122:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
2123:                                .getCode());
2124:                balancesToCheck.add(cbBalance);
2125:                balancesToCheck.add(acBalance);
2126:                balancesToCheck.add(encumbranceBalance);
2127:
2128:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2129:
2130:                // sanity check - all the balances were selected?
2131:                assertEquals("balances to check were all selected? ",
2132:                        new Integer(balancesToCheck.size()), new Integer(
2133:                                orgRevProcess.getBalancesSelected()));
2134:
2135:                List<OriginEntryFull> originEntries = orgRevProcess
2136:                        .getGeneratedOriginEntries();
2137:                logAllEntries(originEntries);
2138:
2139:                assertEquals("correct number of origin entries returned? ",
2140:                        new Integer(originEntries.size()), new Integer(2));
2141:
2142:                // check the origin entries
2143:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
2144:                        "01", DEFAULT_BALANCE_CHART,
2145:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
2146:                        new KualiDecimal(2000));
2147:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
2148:                        "01", DEFAULT_BALANCE_CHART,
2149:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
2150:                        new KualiDecimal(2000));
2151:            }
2152:
2153:            /**
2154:             * Tests that Logic C2 generates the correct origin entries for Scenario 6, Actual + encumbrance exceeds budget
2155:             */
2156:            public void testBudgetGreaterThanActualVariancesLessThanEncumbrancesLogicC2() {
2157:                LOG
2158:                        .info("budget great than actual, variance less than encumbrances test started...");
2159:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2160:
2161:                // add balances to check C2
2162:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO6_CURRENT_BUDGET_BALANCE
2163:                        .convertToBalance();
2164:                cbBalance
2165:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
2166:                                .getCode());
2167:                Balance acBalance = BALANCE_FIXTURE.SCENARIO6_ACTUAL_BALANCE
2168:                        .convertToBalance();
2169:                acBalance
2170:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
2171:                                .getCode());
2172:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO6_ENCUMBRANCE_BALANCE
2173:                        .convertToBalance();
2174:                encumbranceBalance
2175:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
2176:                                .getCode());
2177:                balancesToCheck.add(cbBalance);
2178:                balancesToCheck.add(acBalance);
2179:                balancesToCheck.add(encumbranceBalance);
2180:
2181:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2182:
2183:                // sanity check - all the balances were selected?
2184:                assertEquals("balances to check were all selected? ",
2185:                        new Integer(balancesToCheck.size()), new Integer(
2186:                                orgRevProcess.getBalancesSelected()));
2187:
2188:                List<OriginEntryFull> originEntries = orgRevProcess
2189:                        .getGeneratedOriginEntries();
2190:                logAllEntries(originEntries);
2191:
2192:                assertEquals("correct number of origin entries returned? ",
2193:                        new Integer(originEntries.size()), new Integer(2));
2194:
2195:                // check the origin entries
2196:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
2197:                        "01", DEFAULT_BALANCE_CHART,
2198:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
2199:                        new KualiDecimal(2000));
2200:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
2201:                        "01", DEFAULT_BALANCE_CHART,
2202:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
2203:                        new KualiDecimal(2000));
2204:            }
2205:
2206:            /**
2207:             * Tests that Logic N1 generates the correct origin entries for Scenario 6, Actual + encumbrance exceeds budget
2208:             */
2209:            public void testBudgetGreaterThanActualVariancesLessThanEncumbrancesLogicN1() {
2210:                LOG
2211:                        .info("budget great than actual, variance less than encumbrances test started...");
2212:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2213:
2214:                // add balances to check N1
2215:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO6_CURRENT_BUDGET_BALANCE
2216:                        .convertToBalance();
2217:                cbBalance
2218:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
2219:                                .getCode());
2220:                Balance acBalance = BALANCE_FIXTURE.SCENARIO6_ACTUAL_BALANCE
2221:                        .convertToBalance();
2222:                acBalance
2223:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
2224:                                .getCode());
2225:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO6_ENCUMBRANCE_BALANCE
2226:                        .convertToBalance();
2227:                encumbranceBalance
2228:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
2229:                                .getCode());
2230:                balancesToCheck.add(cbBalance);
2231:                balancesToCheck.add(acBalance);
2232:                balancesToCheck.add(encumbranceBalance);
2233:
2234:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2235:
2236:                // sanity check - all the balances were selected?
2237:                assertEquals("balances to check were all selected? ",
2238:                        new Integer(balancesToCheck.size()), new Integer(
2239:                                orgRevProcess.getBalancesSelected()));
2240:
2241:                List<OriginEntryFull> originEntries = orgRevProcess
2242:                        .getGeneratedOriginEntries();
2243:                logAllEntries(originEntries);
2244:
2245:                assertEquals("correct number of origin entries returned? ",
2246:                        new Integer(originEntries.size()), new Integer(2));
2247:
2248:                // check the origin entries
2249:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
2250:                        "01", DEFAULT_BALANCE_CHART,
2251:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
2252:                        new KualiDecimal(2000));
2253:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
2254:                        "01", DEFAULT_BALANCE_CHART,
2255:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
2256:                        new KualiDecimal(2000));
2257:            }
2258:
2259:            /**
2260:             * Tests that Logic N2 generates the correct origin entries for Scenario 6, Actual + encumbrance exceeds budget
2261:             */
2262:            public void testBudgetGreaterThanActualVariancesLessThanEncumbrancesLogicN2() {
2263:                LOG
2264:                        .info("budget great than actual, variance less than encumbrances test started...");
2265:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2266:
2267:                // add balances to check N2
2268:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO6_CURRENT_BUDGET_BALANCE
2269:                        .convertToBalance();
2270:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
2271:                        .getCode());
2272:                Balance acBalance = BALANCE_FIXTURE.SCENARIO6_ACTUAL_BALANCE
2273:                        .convertToBalance();
2274:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
2275:                        .getCode());
2276:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO6_ENCUMBRANCE_BALANCE
2277:                        .convertToBalance();
2278:                encumbranceBalance
2279:                        .setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
2280:                                .getCode());
2281:                balancesToCheck.add(cbBalance);
2282:                balancesToCheck.add(acBalance);
2283:                balancesToCheck.add(encumbranceBalance);
2284:
2285:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2286:
2287:                // sanity check - all the balances were selected?
2288:                assertEquals("balances to check were all selected? ",
2289:                        new Integer(balancesToCheck.size()), new Integer(
2290:                                orgRevProcess.getBalancesSelected()));
2291:
2292:                List<OriginEntryFull> originEntries = orgRevProcess
2293:                        .getGeneratedOriginEntries();
2294:                logAllEntries(originEntries);
2295:
2296:                assertEquals("correct number of origin entries returned? ",
2297:                        new Integer(originEntries.size()), new Integer(2));
2298:
2299:                // check the origin entries
2300:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
2301:                        "13", DEFAULT_BALANCE_CHART,
2302:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
2303:                        new KualiDecimal(-2000));
2304:                assertOriginEntry(
2305:                        originEntries.get(1),
2306:                        previousFiscalYear,
2307:                        "13",
2308:                        DEFAULT_BALANCE_CHART,
2309:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
2310:                        "7900", "RE", "EX", new KualiDecimal(2000));
2311:            }
2312:
2313:            /**
2314:             * Tests that Logic R1 generates the correct origin entries for Scenario 6, Actual + encumbrance exceeds budget
2315:             */
2316:            public void testBudgetGreaterThanActualVariancesLessThanEncumbrancesLogicR1() {
2317:                LOG
2318:                        .info("budget great than actual, variance less than encumbrances test started...");
2319:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2320:
2321:                // add balances to check R1
2322:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO6_CURRENT_BUDGET_BALANCE
2323:                        .convertToBalance();
2324:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
2325:                        .getCode());
2326:                Balance acBalance = BALANCE_FIXTURE.SCENARIO6_ACTUAL_BALANCE
2327:                        .convertToBalance();
2328:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
2329:                        .getCode());
2330:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO6_ENCUMBRANCE_BALANCE
2331:                        .convertToBalance();
2332:                encumbranceBalance
2333:                        .setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
2334:                                .getCode());
2335:                balancesToCheck.add(cbBalance);
2336:                balancesToCheck.add(acBalance);
2337:                balancesToCheck.add(encumbranceBalance);
2338:
2339:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2340:
2341:                // sanity check - all the balances were selected?
2342:                assertEquals("balances to check were all selected? ",
2343:                        new Integer(balancesToCheck.size()), new Integer(
2344:                                orgRevProcess.getBalancesSelected()));
2345:
2346:                List<OriginEntryFull> originEntries = orgRevProcess
2347:                        .getGeneratedOriginEntries();
2348:                logAllEntries(originEntries);
2349:
2350:                assertEquals("correct number of origin entries returned? ",
2351:                        new Integer(originEntries.size()), new Integer(2));
2352:
2353:                // check the origin entries
2354:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
2355:                        "01", DEFAULT_BALANCE_CHART,
2356:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
2357:                        new KualiDecimal(2000));
2358:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
2359:                        "01", DEFAULT_BALANCE_CHART,
2360:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
2361:                        new KualiDecimal(2000));
2362:            }
2363:
2364:            /**
2365:             * Tests that Logic R2 generates the correct origin entries for Scenario 6, Actual + encumbrance exceeds budget
2366:             */
2367:            public void testBudgetGreaterThanActualVariancesLessThanEncumbrancesLogicR2() {
2368:                LOG
2369:                        .info("budget great than actual, variance less than encumbrances test started...");
2370:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2371:
2372:                // add balances to check R2
2373:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO6_CURRENT_BUDGET_BALANCE
2374:                        .convertToBalance();
2375:                cbBalance
2376:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
2377:                                .getCode());
2378:                Balance acBalance = BALANCE_FIXTURE.SCENARIO6_ACTUAL_BALANCE
2379:                        .convertToBalance();
2380:                acBalance
2381:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
2382:                                .getCode());
2383:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO6_ENCUMBRANCE_BALANCE
2384:                        .convertToBalance();
2385:                encumbranceBalance
2386:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
2387:                                .getCode());
2388:                balancesToCheck.add(cbBalance);
2389:                balancesToCheck.add(acBalance);
2390:                balancesToCheck.add(encumbranceBalance);
2391:
2392:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2393:
2394:                // sanity check - all the balances were selected?
2395:                assertEquals("balances to check were all selected? ",
2396:                        new Integer(balancesToCheck.size()), new Integer(
2397:                                orgRevProcess.getBalancesSelected()));
2398:
2399:                List<OriginEntryFull> originEntries = orgRevProcess
2400:                        .getGeneratedOriginEntries();
2401:                logAllEntries(originEntries);
2402:
2403:                assertEquals("correct number of origin entries returned? ",
2404:                        new Integer(originEntries.size()), new Integer(2));
2405:
2406:                // check the origin entries
2407:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
2408:                        "13", DEFAULT_BALANCE_CHART,
2409:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
2410:                        new KualiDecimal(-2000));
2411:                assertOriginEntry(
2412:                        originEntries.get(1),
2413:                        previousFiscalYear,
2414:                        "13",
2415:                        DEFAULT_BALANCE_CHART,
2416:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
2417:                        "7900", "RE", "EX", new KualiDecimal(2000));
2418:            }
2419:
2420:            /*
2421:             * ************** SCENARIO 7 *****************
2422:             */
2423:            /**
2424:             * Tests that Logic A generates the correct origin entries for Scenario 7, Actual exceeds budget, and there's an encumbrance
2425:             */
2426:            public void testActualGreaterThanBudgetWithEncumbrancesLogicA() {
2427:                LOG
2428:                        .info("actual greater than budget, with encumbrances test started...");
2429:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2430:
2431:                // add balances to check A
2432:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO7_CURRENT_BUDGET_BALANCE
2433:                        .convertToBalance();
2434:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
2435:                        .getCode());
2436:                Balance acBalance = BALANCE_FIXTURE.SCENARIO7_ACTUAL_BALANCE
2437:                        .convertToBalance();
2438:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
2439:                        .getCode());
2440:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO7_ENCUMBRANCE_BALANCE
2441:                        .convertToBalance();
2442:                encumbranceBalance
2443:                        .setObjectCode(OBJECT_CODE_FIXTURE.C01_ORG_WAGES_CODE
2444:                                .getCode());
2445:                balancesToCheck.add(cbBalance);
2446:                balancesToCheck.add(acBalance);
2447:                balancesToCheck.add(encumbranceBalance);
2448:
2449:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2450:
2451:                // sanity check - all the balances were selected?
2452:                assertEquals("balances to check were all selected? ",
2453:                        new Integer(balancesToCheck.size()), new Integer(
2454:                                orgRevProcess.getBalancesSelected()));
2455:
2456:                List<OriginEntryFull> originEntries = orgRevProcess
2457:                        .getGeneratedOriginEntries();
2458:                logAllEntries(originEntries);
2459:
2460:                assertEquals("correct number of origin entries returned? ",
2461:                        new Integer(originEntries.size()), new Integer(2));
2462:
2463:                // check the origin entries
2464:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
2465:                        "01", DEFAULT_BALANCE_CHART,
2466:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
2467:                        new KualiDecimal(-3000));
2468:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
2469:                        "01", DEFAULT_BALANCE_CHART,
2470:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
2471:                        new KualiDecimal(-3000));
2472:            }
2473:
2474:            /**
2475:             * Tests that Logic C1 generates the correct origin entries for Scenario 7, Actual exceeds budget, and there's an encumbrance
2476:             */
2477:            public void testActualGreaterThanBudgetWithEncumbrancesLogicC1() {
2478:                LOG
2479:                        .info("actual greater than budget, with encumbrances test started...");
2480:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2481:
2482:                // add balances to check C1
2483:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO7_CURRENT_BUDGET_BALANCE
2484:                        .convertToBalance();
2485:                cbBalance
2486:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
2487:                                .getCode());
2488:                Balance acBalance = BALANCE_FIXTURE.SCENARIO7_ACTUAL_BALANCE
2489:                        .convertToBalance();
2490:                acBalance
2491:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
2492:                                .getCode());
2493:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO7_ENCUMBRANCE_BALANCE
2494:                        .convertToBalance();
2495:                encumbranceBalance
2496:                        .setObjectCode(OBJECT_CODE_FIXTURE.C02_SALARY_FRINGES_CODE
2497:                                .getCode());
2498:                balancesToCheck.add(cbBalance);
2499:                balancesToCheck.add(acBalance);
2500:                balancesToCheck.add(encumbranceBalance);
2501:
2502:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2503:
2504:                // sanity check - all the balances were selected?
2505:                assertEquals("balances to check were all selected? ",
2506:                        new Integer(balancesToCheck.size()), new Integer(
2507:                                orgRevProcess.getBalancesSelected()));
2508:
2509:                List<OriginEntryFull> originEntries = orgRevProcess
2510:                        .getGeneratedOriginEntries();
2511:                logAllEntries(originEntries);
2512:
2513:                assertEquals("correct number of origin entries returned? ",
2514:                        new Integer(originEntries.size()), new Integer(2));
2515:
2516:                // check the origin entries
2517:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
2518:                        "13", DEFAULT_BALANCE_CHART,
2519:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
2520:                        new KualiDecimal(3000));
2521:                assertOriginEntry(
2522:                        originEntries.get(1),
2523:                        previousFiscalYear,
2524:                        "13",
2525:                        DEFAULT_BALANCE_CHART,
2526:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
2527:                        "7900", "RE", "EX", new KualiDecimal(-3000));
2528:            }
2529:
2530:            /**
2531:             * Tests that Logic C2 generates the correct origin entries for Scenario 7, Actual exceeds budget, and there's an encumbrance
2532:             */
2533:            public void testActualGreaterThanBudgetWithEncumbrancesLogicC2() {
2534:                LOG
2535:                        .info("actual greater than budget, with encumbrances test started...");
2536:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2537:
2538:                // add balances to check C2
2539:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO7_CURRENT_BUDGET_BALANCE
2540:                        .convertToBalance();
2541:                cbBalance
2542:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
2543:                                .getCode());
2544:                Balance acBalance = BALANCE_FIXTURE.SCENARIO7_ACTUAL_BALANCE
2545:                        .convertToBalance();
2546:                acBalance
2547:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
2548:                                .getCode());
2549:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO7_ENCUMBRANCE_BALANCE
2550:                        .convertToBalance();
2551:                encumbranceBalance
2552:                        .setObjectCode(OBJECT_CODE_FIXTURE.C03_FINANCIAL_AID_CODE
2553:                                .getCode());
2554:                balancesToCheck.add(cbBalance);
2555:                balancesToCheck.add(acBalance);
2556:                balancesToCheck.add(encumbranceBalance);
2557:
2558:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2559:
2560:                // sanity check - all the balances were selected?
2561:                assertEquals("balances to check were all selected? ",
2562:                        new Integer(balancesToCheck.size()), new Integer(
2563:                                orgRevProcess.getBalancesSelected()));
2564:
2565:                List<OriginEntryFull> originEntries = orgRevProcess
2566:                        .getGeneratedOriginEntries();
2567:                logAllEntries(originEntries);
2568:
2569:                assertEquals("correct number of origin entries returned? ",
2570:                        new Integer(originEntries.size()), new Integer(2));
2571:
2572:                // check the origin entries
2573:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
2574:                        "13", DEFAULT_BALANCE_CHART,
2575:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
2576:                        new KualiDecimal(3000));
2577:                assertOriginEntry(
2578:                        originEntries.get(1),
2579:                        previousFiscalYear,
2580:                        "13",
2581:                        DEFAULT_BALANCE_CHART,
2582:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
2583:                        "7900", "RE", "EX", new KualiDecimal(-3000));
2584:            }
2585:
2586:            /**
2587:             * Tests that Logic N1 generates the correct origin entries for Scenario 7, Actual exceeds budget, and there's an encumbrance
2588:             */
2589:            public void testActualGreaterThanBudgetWithEncumbrancesLogicN1() {
2590:                LOG
2591:                        .info("actual greater than budget, with encumbrances test started...");
2592:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2593:
2594:                // add balances to check N1
2595:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO7_CURRENT_BUDGET_BALANCE
2596:                        .convertToBalance();
2597:                cbBalance
2598:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
2599:                                .getCode());
2600:                Balance acBalance = BALANCE_FIXTURE.SCENARIO7_ACTUAL_BALANCE
2601:                        .convertToBalance();
2602:                acBalance
2603:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
2604:                                .getCode());
2605:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO7_ENCUMBRANCE_BALANCE
2606:                        .convertToBalance();
2607:                encumbranceBalance
2608:                        .setObjectCode(OBJECT_CODE_FIXTURE.C04_CAPITAL_EQUIP_CODE
2609:                                .getCode());
2610:                balancesToCheck.add(cbBalance);
2611:                balancesToCheck.add(acBalance);
2612:                balancesToCheck.add(encumbranceBalance);
2613:
2614:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2615:
2616:                // sanity check - all the balances were selected?
2617:                assertEquals("balances to check were all selected? ",
2618:                        new Integer(balancesToCheck.size()), new Integer(
2619:                                orgRevProcess.getBalancesSelected()));
2620:
2621:                List<OriginEntryFull> originEntries = orgRevProcess
2622:                        .getGeneratedOriginEntries();
2623:                logAllEntries(originEntries);
2624:
2625:                assertEquals("correct number of origin entries returned? ",
2626:                        new Integer(originEntries.size()), new Integer(2));
2627:
2628:                // check the origin entries
2629:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
2630:                        "01", DEFAULT_BALANCE_CHART,
2631:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
2632:                        new KualiDecimal(-3000));
2633:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
2634:                        "01", DEFAULT_BALANCE_CHART,
2635:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
2636:                        new KualiDecimal(-3000));
2637:            }
2638:
2639:            /**
2640:             * Tests that Logic N2 generates the correct origin entries for Scenario 7, Actual exceeds budget, and there's an encumbrance
2641:             */
2642:            public void testActualGreaterThanBudgetWithEncumbrancesLogicN2() {
2643:                LOG
2644:                        .info("actual greater than budget, with encumbrances test started...");
2645:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2646:
2647:                // add balances to check N2
2648:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO7_CURRENT_BUDGET_BALANCE
2649:                        .convertToBalance();
2650:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
2651:                        .getCode());
2652:                Balance acBalance = BALANCE_FIXTURE.SCENARIO7_ACTUAL_BALANCE
2653:                        .convertToBalance();
2654:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
2655:                        .getCode());
2656:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO7_ENCUMBRANCE_BALANCE
2657:                        .convertToBalance();
2658:                encumbranceBalance
2659:                        .setObjectCode(OBJECT_CODE_FIXTURE.C05_RESERVE_CODE
2660:                                .getCode());
2661:                balancesToCheck.add(cbBalance);
2662:                balancesToCheck.add(acBalance);
2663:                balancesToCheck.add(encumbranceBalance);
2664:
2665:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2666:
2667:                // sanity check - all the balances were selected?
2668:                assertEquals("balances to check were all selected? ",
2669:                        new Integer(balancesToCheck.size()), new Integer(
2670:                                orgRevProcess.getBalancesSelected()));
2671:
2672:                List<OriginEntryFull> originEntries = orgRevProcess
2673:                        .getGeneratedOriginEntries();
2674:                logAllEntries(originEntries);
2675:
2676:                assertEquals("correct number of origin entries returned? ",
2677:                        new Integer(originEntries.size()), new Integer(2));
2678:
2679:                // check the origin entries
2680:                assertOriginEntry(originEntries.get(0), currentFiscalYear,
2681:                        "01", DEFAULT_BALANCE_CHART,
2682:                        DEFAULT_BALANCE_ACCOUNT_NBR, "0110", "CB", "IN",
2683:                        new KualiDecimal(-3000));
2684:                assertOriginEntry(originEntries.get(1), currentFiscalYear,
2685:                        "01", DEFAULT_BALANCE_CHART,
2686:                        DEFAULT_BALANCE_ACCOUNT_NBR, "5000", "CB", "EX",
2687:                        new KualiDecimal(-3000));
2688:            }
2689:
2690:            /**
2691:             * Tests that Logic R1 generates the correct origin entries for Scenario 7, Actual exceeds budget, and there's an encumbrance
2692:             */
2693:            public void testActualGreaterThanBudgetWithEncumbrancesLogicR1() {
2694:                LOG
2695:                        .info("actual greater than budget, with encumbrances test started...");
2696:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2697:
2698:                // add balances to check R1
2699:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO7_CURRENT_BUDGET_BALANCE
2700:                        .convertToBalance();
2701:                cbBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
2702:                        .getCode());
2703:                Balance acBalance = BALANCE_FIXTURE.SCENARIO7_ACTUAL_BALANCE
2704:                        .convertToBalance();
2705:                acBalance.setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
2706:                        .getCode());
2707:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO7_ENCUMBRANCE_BALANCE
2708:                        .convertToBalance();
2709:                encumbranceBalance
2710:                        .setObjectCode(OBJECT_CODE_FIXTURE.C08_TRAVEL_CODE
2711:                                .getCode());
2712:                balancesToCheck.add(cbBalance);
2713:                balancesToCheck.add(acBalance);
2714:                balancesToCheck.add(encumbranceBalance);
2715:
2716:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2717:
2718:                // sanity check - all the balances were selected?
2719:                assertEquals("balances to check were all selected? ",
2720:                        new Integer(balancesToCheck.size()), new Integer(
2721:                                orgRevProcess.getBalancesSelected()));
2722:
2723:                List<OriginEntryFull> originEntries = orgRevProcess
2724:                        .getGeneratedOriginEntries();
2725:                logAllEntries(originEntries);
2726:
2727:                assertEquals("correct number of origin entries returned? ",
2728:                        new Integer(originEntries.size()), new Integer(2));
2729:
2730:                // check the origin entries
2731:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
2732:                        "13", DEFAULT_BALANCE_CHART,
2733:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
2734:                        new KualiDecimal(3000));
2735:                assertOriginEntry(
2736:                        originEntries.get(1),
2737:                        previousFiscalYear,
2738:                        "13",
2739:                        DEFAULT_BALANCE_CHART,
2740:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
2741:                        "7900", "RE", "EX", new KualiDecimal(-3000));
2742:            }
2743:
2744:            /**
2745:             * Tests that Logic R2 generates the correct origin entries for Scenario 7, Actual exceeds budget, and there's an encumbrance
2746:             */
2747:            public void testActualGreaterThanBudgetWithEncumbrancesLogicR2() {
2748:                LOG
2749:                        .info("actual greater than budget, with encumbrances test started...");
2750:                List<Balance> balancesToCheck = new ArrayList<Balance>();
2751:
2752:                // add balances to check R2
2753:                Balance cbBalance = BALANCE_FIXTURE.SCENARIO7_CURRENT_BUDGET_BALANCE
2754:                        .convertToBalance();
2755:                cbBalance
2756:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
2757:                                .getCode());
2758:                Balance acBalance = BALANCE_FIXTURE.SCENARIO7_ACTUAL_BALANCE
2759:                        .convertToBalance();
2760:                acBalance
2761:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
2762:                                .getCode());
2763:                Balance encumbranceBalance = BALANCE_FIXTURE.SCENARIO7_ENCUMBRANCE_BALANCE
2764:                        .convertToBalance();
2765:                encumbranceBalance
2766:                        .setObjectCode(OBJECT_CODE_FIXTURE.C09_OTHER_EXPENSE_CODE
2767:                                .getCode());
2768:                balancesToCheck.add(cbBalance);
2769:                balancesToCheck.add(acBalance);
2770:                balancesToCheck.add(encumbranceBalance);
2771:
2772:                OriginEntryGroup orgRevGroup = runOrganizationReversionProcess(balancesToCheck);
2773:
2774:                // sanity check - all the balances were selected?
2775:                assertEquals("balances to check were all selected? ",
2776:                        new Integer(balancesToCheck.size()), new Integer(
2777:                                orgRevProcess.getBalancesSelected()));
2778:
2779:                List<OriginEntryFull> originEntries = orgRevProcess
2780:                        .getGeneratedOriginEntries();
2781:                logAllEntries(originEntries);
2782:
2783:                assertEquals("correct number of origin entries returned? ",
2784:                        new Integer(originEntries.size()), new Integer(2));
2785:
2786:                // check the origin entries
2787:                assertOriginEntry(originEntries.get(0), previousFiscalYear,
2788:                        "13", DEFAULT_BALANCE_CHART,
2789:                        DEFAULT_BALANCE_ACCOUNT_NBR, "7900", "RE", "EX",
2790:                        new KualiDecimal(3000));
2791:                assertOriginEntry(
2792:                        originEntries.get(1),
2793:                        previousFiscalYear,
2794:                        "13",
2795:                        DEFAULT_BALANCE_CHART,
2796:                        OrganizationReversionMockService.DEFAULT_BUDGET_REVERSION_ACCOUNT,
2797:                        "7900", "RE", "EX", new KualiDecimal(-3000));
2798:            }
2799:        }
w___w___w___._j___a___v___a2_s__._c__om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.