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

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


001:        /*
002:         * Copyright 2006-2007 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         * http://www.opensource.org/licenses/ecl1.php
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.kuali.module.financial.rules;
017:
018:        import static org.kuali.module.financial.rules.IsDebitTestUtils.Amount.NEGATIVE;
019:        import static org.kuali.module.financial.rules.IsDebitTestUtils.Amount.POSITIVE;
020:        import static org.kuali.test.fixtures.UserNameFixture.LRAAB;
021:
022:        import org.kuali.core.service.DataDictionaryService;
023:        import org.kuali.core.service.DocumentService;
024:        import org.kuali.core.service.DocumentTypeService;
025:        import org.kuali.core.util.KualiDecimal;
026:        import org.kuali.kfs.bo.AccountingLine;
027:        import org.kuali.kfs.bo.SourceAccountingLine;
028:        import org.kuali.kfs.context.KualiTestBase;
029:        import org.kuali.kfs.context.SpringContext;
030:        import org.kuali.kfs.document.AccountingDocument;
031:        import org.kuali.module.financial.document.DisbursementVoucherDocument;
032:        import org.kuali.test.ConfigureContext;
033:
034:        /**
035:         * This class tests the DisbursementVoucherDocumentRule
036:         */
037:        @ConfigureContext(session=LRAAB)
038:        public class DisbursementVoucherDocumentRuleTest extends KualiTestBase {
039:
040:            /**
041:             * test that an <code>IllegalStateException</code> gets thrown for an error correction document
042:             * 
043:             * @throws Exception
044:             */
045:            public void testIsDebit_errorCorrection() throws Exception {
046:                AccountingDocument accountingDocument = IsDebitTestUtils
047:                        .getErrorCorrectionDocument(SpringContext
048:                                .getBean(DocumentService.class),
049:                                DisbursementVoucherDocument.class);
050:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
051:                        accountingDocument, SourceAccountingLine.class,
052:                        POSITIVE);
053:
054:                assertTrue(IsDebitTestUtils
055:                        .isErrorCorrectionIllegalStateException(SpringContext
056:                                .getBean(DocumentTypeService.class),
057:                                SpringContext
058:                                        .getBean(DataDictionaryService.class),
059:                                accountingDocument, accountingLine));
060:            }
061:
062:            /**
063:             * tests true is returned for a positive income
064:             * 
065:             * @throws Exception
066:             */
067:            public void testIsDebit_income_positveAmount() throws Exception {
068:                AccountingDocument accountingDocument = IsDebitTestUtils
069:                        .getDocument(SpringContext
070:                                .getBean(DocumentService.class),
071:                                DisbursementVoucherDocument.class);
072:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
073:                        accountingDocument, SourceAccountingLine.class,
074:                        POSITIVE);
075:
076:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
077:                        .getBean(DocumentTypeService.class), SpringContext
078:                        .getBean(DataDictionaryService.class),
079:                        accountingDocument, accountingLine));
080:            }
081:
082:            /**
083:             * tests an <code>IllegalStateExcpetion</code> is thrown for a negative income
084:             * 
085:             * @throws Exception
086:             */
087:            public void testIsDebit_income_negativeAmount() throws Exception {
088:                AccountingDocument accountingDocument = IsDebitTestUtils
089:                        .getDocument(SpringContext
090:                                .getBean(DocumentService.class),
091:                                DisbursementVoucherDocument.class);
092:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
093:                        accountingDocument, SourceAccountingLine.class,
094:                        NEGATIVE);
095:
096:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
097:                        SpringContext.getBean(DocumentTypeService.class),
098:                        SpringContext.getBean(DataDictionaryService.class),
099:                        accountingDocument, accountingLine));
100:            }
101:
102:            /**
103:             * tests an <code>IllegalStateException</code> is thrown for a zero income
104:             * 
105:             * @throws Exception
106:             */
107:            public void testIsDebit_income_zeroAmount() throws Exception {
108:                AccountingDocument accountingDocument = IsDebitTestUtils
109:                        .getDocument(SpringContext
110:                                .getBean(DocumentService.class),
111:                                DisbursementVoucherDocument.class);
112:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
113:                        accountingDocument, SourceAccountingLine.class,
114:                        KualiDecimal.ZERO);
115:
116:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
117:                        SpringContext.getBean(DocumentTypeService.class),
118:                        SpringContext.getBean(DataDictionaryService.class),
119:                        accountingDocument, accountingLine));
120:            }
121:
122:            /**
123:             * tests true is returned for a positive expense
124:             * 
125:             * @throws Exception
126:             */
127:            public void testIsDebit_expense_positveAmount() throws Exception {
128:                AccountingDocument accountingDocument = IsDebitTestUtils
129:                        .getDocument(SpringContext
130:                                .getBean(DocumentService.class),
131:                                DisbursementVoucherDocument.class);
132:                AccountingLine accountingLine = IsDebitTestUtils
133:                        .getExpenseLine(accountingDocument,
134:                                SourceAccountingLine.class, POSITIVE);
135:
136:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
137:                        .getBean(DocumentTypeService.class), SpringContext
138:                        .getBean(DataDictionaryService.class),
139:                        accountingDocument, accountingLine));
140:            }
141:
142:            /**
143:             * tests an <code>IllegalStateException</code> is thrown for a negative expense
144:             * 
145:             * @throws Exception
146:             */
147:            public void testIsDebit_expense_negativeAmount() throws Exception {
148:                AccountingDocument accountingDocument = IsDebitTestUtils
149:                        .getDocument(SpringContext
150:                                .getBean(DocumentService.class),
151:                                DisbursementVoucherDocument.class);
152:                AccountingLine accountingLine = IsDebitTestUtils
153:                        .getExpenseLine(accountingDocument,
154:                                SourceAccountingLine.class, NEGATIVE);
155:
156:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
157:                        SpringContext.getBean(DocumentTypeService.class),
158:                        SpringContext.getBean(DataDictionaryService.class),
159:                        accountingDocument, accountingLine));
160:            }
161:
162:            /**
163:             * tests an <code>IllegalStateException</code> is thrown for a zero expense
164:             * 
165:             * @throws Exception
166:             */
167:            public void testIsDebit_expense_zeroAmount() throws Exception {
168:                AccountingDocument accountingDocument = IsDebitTestUtils
169:                        .getDocument(SpringContext
170:                                .getBean(DocumentService.class),
171:                                DisbursementVoucherDocument.class);
172:                AccountingLine accountingLine = IsDebitTestUtils
173:                        .getExpenseLine(accountingDocument,
174:                                SourceAccountingLine.class, KualiDecimal.ZERO);
175:
176:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
177:                        SpringContext.getBean(DocumentTypeService.class),
178:                        SpringContext.getBean(DataDictionaryService.class),
179:                        accountingDocument, accountingLine));
180:            }
181:
182:            /**
183:             * tests true is returned for a positive asset
184:             * 
185:             * @throws Exception
186:             */
187:            public void testIsDebit_asset_positveAmount() throws Exception {
188:                AccountingDocument accountingDocument = IsDebitTestUtils
189:                        .getDocument(SpringContext
190:                                .getBean(DocumentService.class),
191:                                DisbursementVoucherDocument.class);
192:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
193:                        accountingDocument, SourceAccountingLine.class,
194:                        POSITIVE);
195:
196:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
197:                        .getBean(DocumentTypeService.class), SpringContext
198:                        .getBean(DataDictionaryService.class),
199:                        accountingDocument, accountingLine));
200:            }
201:
202:            /**
203:             * tests an <code>IllegalStateException</code> is thrown for a negative asset
204:             * 
205:             * @throws Exception
206:             */
207:            public void testIsDebit_asset_negativeAmount() throws Exception {
208:                AccountingDocument accountingDocument = IsDebitTestUtils
209:                        .getDocument(SpringContext
210:                                .getBean(DocumentService.class),
211:                                DisbursementVoucherDocument.class);
212:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
213:                        accountingDocument, SourceAccountingLine.class,
214:                        NEGATIVE);
215:
216:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
217:                        SpringContext.getBean(DocumentTypeService.class),
218:                        SpringContext.getBean(DataDictionaryService.class),
219:                        accountingDocument, accountingLine));
220:            }
221:
222:            /**
223:             * tests an <code>IllegalStateException</code> is thrown for a zero asset
224:             * 
225:             * @throws Exception
226:             */
227:            public void testIsDebit_asset_zeroAmount() throws Exception {
228:                AccountingDocument accountingDocument = IsDebitTestUtils
229:                        .getDocument(SpringContext
230:                                .getBean(DocumentService.class),
231:                                DisbursementVoucherDocument.class);
232:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
233:                        accountingDocument, SourceAccountingLine.class,
234:                        KualiDecimal.ZERO);
235:
236:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
237:                        SpringContext.getBean(DocumentTypeService.class),
238:                        SpringContext.getBean(DataDictionaryService.class),
239:                        accountingDocument, accountingLine));
240:            }
241:
242:            /**
243:             * tests true is returned for a positive liability
244:             * 
245:             * @throws Exception
246:             */
247:            public void testIsDebit_liability_positveAmount() throws Exception {
248:                AccountingDocument accountingDocument = IsDebitTestUtils
249:                        .getDocument(SpringContext
250:                                .getBean(DocumentService.class),
251:                                DisbursementVoucherDocument.class);
252:                AccountingLine accountingLine = IsDebitTestUtils
253:                        .getLiabilityLine(accountingDocument,
254:                                SourceAccountingLine.class, POSITIVE);
255:
256:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
257:                        .getBean(DocumentTypeService.class), SpringContext
258:                        .getBean(DataDictionaryService.class),
259:                        accountingDocument, accountingLine));
260:            }
261:
262:            /**
263:             * tests an <code>IllegalStateException</code> is thrown for a negative liability
264:             * 
265:             * @throws Exception
266:             */
267:            public void testIsDebit_liability_negativeAmount() throws Exception {
268:                AccountingDocument accountingDocument = IsDebitTestUtils
269:                        .getDocument(SpringContext
270:                                .getBean(DocumentService.class),
271:                                DisbursementVoucherDocument.class);
272:                AccountingLine accountingLine = IsDebitTestUtils
273:                        .getLiabilityLine(accountingDocument,
274:                                SourceAccountingLine.class, NEGATIVE);
275:
276:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
277:                        SpringContext.getBean(DocumentTypeService.class),
278:                        SpringContext.getBean(DataDictionaryService.class),
279:                        accountingDocument, accountingLine));
280:            }
281:
282:            /**
283:             * tests an <code>IllegalStateException</code> is thrown for a zero liability
284:             * 
285:             * @throws Exception
286:             */
287:            public void testIsDebit_liability_zeroAmount() throws Exception {
288:                AccountingDocument accountingDocument = IsDebitTestUtils
289:                        .getDocument(SpringContext
290:                                .getBean(DocumentService.class),
291:                                DisbursementVoucherDocument.class);
292:                AccountingLine accountingLine = IsDebitTestUtils
293:                        .getLiabilityLine(accountingDocument,
294:                                SourceAccountingLine.class, KualiDecimal.ZERO);
295:
296:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
297:                        SpringContext.getBean(DocumentTypeService.class),
298:                        SpringContext.getBean(DataDictionaryService.class),
299:                        accountingDocument, accountingLine));
300:            }
301:            // /////////////////////////////////////////////////////////////////////////
302:            // Test Methods End Here //
303:            // /////////////////////////////////////////////////////////////////////////
304:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.