Source Code Cross Referenced for DistributionOfIncomeAndExpenseDocumentRuleTest.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.KHUNTLEY;
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.bo.TargetAccountingLine;
029:        import org.kuali.kfs.context.KualiTestBase;
030:        import org.kuali.kfs.context.SpringContext;
031:        import org.kuali.kfs.document.AccountingDocument;
032:        import org.kuali.module.financial.document.DistributionOfIncomeAndExpenseDocument;
033:        import org.kuali.test.ConfigureContext;
034:
035:        /**
036:         * This class tests the <code>DistributionOfIncomeAndExpenseDocumentRule</code>s
037:         */
038:        @ConfigureContext(session=KHUNTLEY)
039:        public class DistributionOfIncomeAndExpenseDocumentRuleTest extends
040:                KualiTestBase {
041:
042:            /**
043:             * tests true is returned for a positive income
044:             * 
045:             * @throws Exception
046:             */
047:            public void testIsDebit_source_income_positveAmount()
048:                    throws Exception {
049:                AccountingDocument accountingDocument = IsDebitTestUtils
050:                        .getDocument(SpringContext
051:                                .getBean(DocumentService.class),
052:                                DistributionOfIncomeAndExpenseDocument.class);
053:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
054:                        accountingDocument, SourceAccountingLine.class,
055:                        POSITIVE);
056:
057:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
058:                        .getBean(DocumentTypeService.class), SpringContext
059:                        .getBean(DataDictionaryService.class),
060:                        accountingDocument, accountingLine));
061:            }
062:
063:            /**
064:             * tests an <code>IllegalStateException</code> for a negative income
065:             * 
066:             * @throws Exception
067:             */
068:            public void testIsDebit_source_income_negativeAmount()
069:                    throws Exception {
070:                AccountingDocument accountingDocument = IsDebitTestUtils
071:                        .getDocument(SpringContext
072:                                .getBean(DocumentService.class),
073:                                DistributionOfIncomeAndExpenseDocument.class);
074:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
075:                        accountingDocument, SourceAccountingLine.class,
076:                        NEGATIVE);
077:
078:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
079:                        SpringContext.getBean(DocumentTypeService.class),
080:                        SpringContext.getBean(DataDictionaryService.class),
081:                        accountingDocument, accountingLine));
082:            }
083:
084:            /**
085:             * tests an <code>IllegalStateException</code> is thrown for a zero income
086:             * 
087:             * @throws Exception
088:             */
089:            public void testIsDebit_source_income_zeroAmount() throws Exception {
090:
091:                AccountingDocument accountingDocument = IsDebitTestUtils
092:                        .getDocument(SpringContext
093:                                .getBean(DocumentService.class),
094:                                DistributionOfIncomeAndExpenseDocument.class);
095:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
096:                        accountingDocument, SourceAccountingLine.class,
097:                        KualiDecimal.ZERO);
098:
099:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
100:                        SpringContext.getBean(DocumentTypeService.class),
101:                        SpringContext.getBean(DataDictionaryService.class),
102:                        accountingDocument, accountingLine));
103:            }
104:
105:            /**
106:             * tests false is returned for a positive expense
107:             * 
108:             * @throws Exception
109:             */
110:            public void testIsDebit_source_expense_positveAmount()
111:                    throws Exception {
112:                AccountingDocument accountingDocument = IsDebitTestUtils
113:                        .getDocument(SpringContext
114:                                .getBean(DocumentService.class),
115:                                DistributionOfIncomeAndExpenseDocument.class);
116:                AccountingLine accountingLine = IsDebitTestUtils
117:                        .getExpenseLine(accountingDocument,
118:                                SourceAccountingLine.class, POSITIVE);
119:
120:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
121:                        .getBean(DocumentTypeService.class), SpringContext
122:                        .getBean(DataDictionaryService.class),
123:                        accountingDocument, accountingLine));
124:            }
125:
126:            /**
127:             * tests an <code>IllegalStateException</code> is thrown for a negative expense
128:             * 
129:             * @throws Exception
130:             */
131:            public void testIsDebit_source_expense_negativeAmount()
132:                    throws Exception {
133:                AccountingDocument accountingDocument = IsDebitTestUtils
134:                        .getDocument(SpringContext
135:                                .getBean(DocumentService.class),
136:                                DistributionOfIncomeAndExpenseDocument.class);
137:                AccountingLine accountingLine = IsDebitTestUtils
138:                        .getExpenseLine(accountingDocument,
139:                                SourceAccountingLine.class, NEGATIVE);
140:
141:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
142:                        SpringContext.getBean(DocumentTypeService.class),
143:                        SpringContext.getBean(DataDictionaryService.class),
144:                        accountingDocument, accountingLine));
145:            }
146:
147:            /**
148:             * tests an <code>IllegalStateException</code> is thrown for a zero expense
149:             * 
150:             * @throws Exception
151:             */
152:            public void testIsDebit_source_expense_zeroAmount()
153:                    throws Exception {
154:                AccountingDocument accountingDocument = IsDebitTestUtils
155:                        .getDocument(SpringContext
156:                                .getBean(DocumentService.class),
157:                                DistributionOfIncomeAndExpenseDocument.class);
158:                AccountingLine accountingLine = IsDebitTestUtils
159:                        .getExpenseLine(accountingDocument,
160:                                SourceAccountingLine.class, KualiDecimal.ZERO);
161:
162:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
163:                        SpringContext.getBean(DocumentTypeService.class),
164:                        SpringContext.getBean(DataDictionaryService.class),
165:                        accountingDocument, accountingLine));
166:            }
167:
168:            /**
169:             * tests false is returned for a positive asset
170:             * 
171:             * @throws Exception
172:             */
173:            public void testIsDebit_source_asset_positveAmount()
174:                    throws Exception {
175:                AccountingDocument accountingDocument = IsDebitTestUtils
176:                        .getDocument(SpringContext
177:                                .getBean(DocumentService.class),
178:                                DistributionOfIncomeAndExpenseDocument.class);
179:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
180:                        accountingDocument, SourceAccountingLine.class,
181:                        POSITIVE);
182:
183:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
184:                        .getBean(DocumentTypeService.class), SpringContext
185:                        .getBean(DataDictionaryService.class),
186:                        accountingDocument, accountingLine));
187:            }
188:
189:            /**
190:             * tests an <code>IllegalStateException</code> is thrown for a negative asset
191:             * 
192:             * @throws Exception
193:             */
194:            public void testIsDebit_source_asset_negativeAmount()
195:                    throws Exception {
196:                AccountingDocument accountingDocument = IsDebitTestUtils
197:                        .getDocument(SpringContext
198:                                .getBean(DocumentService.class),
199:                                DistributionOfIncomeAndExpenseDocument.class);
200:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
201:                        accountingDocument, SourceAccountingLine.class,
202:                        NEGATIVE);
203:
204:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
205:                        SpringContext.getBean(DocumentTypeService.class),
206:                        SpringContext.getBean(DataDictionaryService.class),
207:                        accountingDocument, accountingLine));
208:            }
209:
210:            /**
211:             * tests an <code>IllegalStateException</code> is thrown for a zero asset
212:             * 
213:             * @throws Exception
214:             */
215:            public void testIsDebit_source_asset_zeroAmount() throws Exception {
216:                AccountingDocument accountingDocument = IsDebitTestUtils
217:                        .getDocument(SpringContext
218:                                .getBean(DocumentService.class),
219:                                DistributionOfIncomeAndExpenseDocument.class);
220:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
221:                        accountingDocument, SourceAccountingLine.class,
222:                        KualiDecimal.ZERO);
223:
224:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
225:                        SpringContext.getBean(DocumentTypeService.class),
226:                        SpringContext.getBean(DataDictionaryService.class),
227:                        accountingDocument, accountingLine));
228:            }
229:
230:            /**
231:             * tests true is returned for a positive liability
232:             * 
233:             * @throws Exception
234:             */
235:            public void testIsDebit_source_liability_positveAmount()
236:                    throws Exception {
237:                AccountingDocument accountingDocument = IsDebitTestUtils
238:                        .getDocument(SpringContext
239:                                .getBean(DocumentService.class),
240:                                DistributionOfIncomeAndExpenseDocument.class);
241:                AccountingLine accountingLine = IsDebitTestUtils
242:                        .getLiabilityLine(accountingDocument,
243:                                SourceAccountingLine.class, POSITIVE);
244:
245:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
246:                        .getBean(DocumentTypeService.class), SpringContext
247:                        .getBean(DataDictionaryService.class),
248:                        accountingDocument, accountingLine));
249:            }
250:
251:            /**
252:             * tests an <code>IllegalStateException</code> is thrown for a negative liability
253:             * 
254:             * @throws Exception
255:             */
256:            public void testIsDebit_source_liability_negativeAmount()
257:                    throws Exception {
258:                AccountingDocument accountingDocument = IsDebitTestUtils
259:                        .getDocument(SpringContext
260:                                .getBean(DocumentService.class),
261:                                DistributionOfIncomeAndExpenseDocument.class);
262:                AccountingLine accountingLine = IsDebitTestUtils
263:                        .getLiabilityLine(accountingDocument,
264:                                SourceAccountingLine.class, NEGATIVE);
265:
266:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
267:                        SpringContext.getBean(DocumentTypeService.class),
268:                        SpringContext.getBean(DataDictionaryService.class),
269:                        accountingDocument, accountingLine));
270:            }
271:
272:            /**
273:             * tests an <code>IllegalStateExcpetion</code> is thrown for a zero liability
274:             * 
275:             * @throws Exception
276:             */
277:            public void testIsDebit_source_liability_zeroAmount()
278:                    throws Exception {
279:                AccountingDocument accountingDocument = IsDebitTestUtils
280:                        .getDocument(SpringContext
281:                                .getBean(DocumentService.class),
282:                                DistributionOfIncomeAndExpenseDocument.class);
283:                AccountingLine accountingLine = IsDebitTestUtils
284:                        .getLiabilityLine(accountingDocument,
285:                                SourceAccountingLine.class, KualiDecimal.ZERO);
286:
287:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
288:                        SpringContext.getBean(DocumentTypeService.class),
289:                        SpringContext.getBean(DataDictionaryService.class),
290:                        accountingDocument, accountingLine));
291:            }
292:
293:            /**
294:             * tests false is returned for a positive income
295:             * 
296:             * @throws Exception
297:             */
298:            public void testIsDebit_target_income_positveAmount()
299:                    throws Exception {
300:                AccountingDocument accountingDocument = IsDebitTestUtils
301:                        .getDocument(SpringContext
302:                                .getBean(DocumentService.class),
303:                                DistributionOfIncomeAndExpenseDocument.class);
304:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
305:                        accountingDocument, TargetAccountingLine.class,
306:                        POSITIVE);
307:
308:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
309:                        .getBean(DocumentTypeService.class), SpringContext
310:                        .getBean(DataDictionaryService.class),
311:                        accountingDocument, accountingLine));
312:            }
313:
314:            /**
315:             * tests an <code>IllegalStateException</code> is thrown for a negative income
316:             * 
317:             * @throws Exception
318:             */
319:            public void testIsDebit_target_income_negativeAmount()
320:                    throws Exception {
321:                AccountingDocument accountingDocument = IsDebitTestUtils
322:                        .getDocument(SpringContext
323:                                .getBean(DocumentService.class),
324:                                DistributionOfIncomeAndExpenseDocument.class);
325:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
326:                        accountingDocument, TargetAccountingLine.class,
327:                        NEGATIVE);
328:
329:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
330:                        SpringContext.getBean(DocumentTypeService.class),
331:                        SpringContext.getBean(DataDictionaryService.class),
332:                        accountingDocument, accountingLine));
333:            }
334:
335:            /**
336:             * tests an <code>IllegalStateException</code> is thrown for a zero income
337:             * 
338:             * @throws Exception
339:             */
340:            public void testIsDebit_target_income_zeroAmount() throws Exception {
341:
342:                AccountingDocument accountingDocument = IsDebitTestUtils
343:                        .getDocument(SpringContext
344:                                .getBean(DocumentService.class),
345:                                DistributionOfIncomeAndExpenseDocument.class);
346:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
347:                        accountingDocument, TargetAccountingLine.class,
348:                        KualiDecimal.ZERO);
349:
350:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
351:                        SpringContext.getBean(DocumentTypeService.class),
352:                        SpringContext.getBean(DataDictionaryService.class),
353:                        accountingDocument, accountingLine));
354:            }
355:
356:            /**
357:             * tests true is returned for a positive expense
358:             * 
359:             * @throws Exception
360:             */
361:            public void testIsDebit_target_expense_positveAmount()
362:                    throws Exception {
363:                AccountingDocument accountingDocument = IsDebitTestUtils
364:                        .getDocument(SpringContext
365:                                .getBean(DocumentService.class),
366:                                DistributionOfIncomeAndExpenseDocument.class);
367:                AccountingLine accountingLine = IsDebitTestUtils
368:                        .getExpenseLine(accountingDocument,
369:                                TargetAccountingLine.class, POSITIVE);
370:
371:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
372:                        .getBean(DocumentTypeService.class), SpringContext
373:                        .getBean(DataDictionaryService.class),
374:                        accountingDocument, accountingLine));
375:            }
376:
377:            /**
378:             * tests an <code>IllegalStateException</code> is thrown for a negative expense
379:             * 
380:             * @throws Exception
381:             */
382:            public void testIsDebit_target_expense_negativeAmount()
383:                    throws Exception {
384:                AccountingDocument accountingDocument = IsDebitTestUtils
385:                        .getDocument(SpringContext
386:                                .getBean(DocumentService.class),
387:                                DistributionOfIncomeAndExpenseDocument.class);
388:                AccountingLine accountingLine = IsDebitTestUtils
389:                        .getExpenseLine(accountingDocument,
390:                                TargetAccountingLine.class, NEGATIVE);
391:
392:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
393:                        SpringContext.getBean(DocumentTypeService.class),
394:                        SpringContext.getBean(DataDictionaryService.class),
395:                        accountingDocument, accountingLine));
396:            }
397:
398:            /**
399:             * tests an <code>IllegalStateException</code> is thrown for a zero expense
400:             * 
401:             * @throws Exception
402:             */
403:            public void testIsDebit_target_expense_zeroAmount()
404:                    throws Exception {
405:                AccountingDocument accountingDocument = IsDebitTestUtils
406:                        .getDocument(SpringContext
407:                                .getBean(DocumentService.class),
408:                                DistributionOfIncomeAndExpenseDocument.class);
409:                AccountingLine accountingLine = IsDebitTestUtils
410:                        .getExpenseLine(accountingDocument,
411:                                TargetAccountingLine.class, KualiDecimal.ZERO);
412:
413:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
414:                        SpringContext.getBean(DocumentTypeService.class),
415:                        SpringContext.getBean(DataDictionaryService.class),
416:                        accountingDocument, accountingLine));
417:            }
418:
419:            /**
420:             * tests true is returned for a positive asset
421:             * 
422:             * @throws Exception
423:             */
424:            public void testIsDebit_target_asset_positveAmount()
425:                    throws Exception {
426:                AccountingDocument accountingDocument = IsDebitTestUtils
427:                        .getDocument(SpringContext
428:                                .getBean(DocumentService.class),
429:                                DistributionOfIncomeAndExpenseDocument.class);
430:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
431:                        accountingDocument, TargetAccountingLine.class,
432:                        POSITIVE);
433:
434:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
435:                        .getBean(DocumentTypeService.class), SpringContext
436:                        .getBean(DataDictionaryService.class),
437:                        accountingDocument, accountingLine));
438:            }
439:
440:            /**
441:             * tests an <code>IllegalStateException</code> is thrnow for a negative asset
442:             * 
443:             * @throws Exception
444:             */
445:            public void testIsDebit_target_asset_negativeAmount()
446:                    throws Exception {
447:                AccountingDocument accountingDocument = IsDebitTestUtils
448:                        .getDocument(SpringContext
449:                                .getBean(DocumentService.class),
450:                                DistributionOfIncomeAndExpenseDocument.class);
451:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
452:                        accountingDocument, TargetAccountingLine.class,
453:                        NEGATIVE);
454:
455:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
456:                        SpringContext.getBean(DocumentTypeService.class),
457:                        SpringContext.getBean(DataDictionaryService.class),
458:                        accountingDocument, accountingLine));
459:            }
460:
461:            /**
462:             * tests an <code>IllegalStateException</code> is thrown for a zero asset
463:             * 
464:             * @throws Exception
465:             */
466:            public void testIsDebit_target_asset_zeroAmount() throws Exception {
467:                AccountingDocument accountingDocument = IsDebitTestUtils
468:                        .getDocument(SpringContext
469:                                .getBean(DocumentService.class),
470:                                DistributionOfIncomeAndExpenseDocument.class);
471:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
472:                        accountingDocument, TargetAccountingLine.class,
473:                        KualiDecimal.ZERO);
474:
475:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
476:                        SpringContext.getBean(DocumentTypeService.class),
477:                        SpringContext.getBean(DataDictionaryService.class),
478:                        accountingDocument, accountingLine));
479:            }
480:
481:            /**
482:             * tests false is returned for a positive liability
483:             * 
484:             * @throws Exception
485:             */
486:            public void testIsDebit_target_liability_positveAmount()
487:                    throws Exception {
488:                AccountingDocument accountingDocument = IsDebitTestUtils
489:                        .getDocument(SpringContext
490:                                .getBean(DocumentService.class),
491:                                DistributionOfIncomeAndExpenseDocument.class);
492:                AccountingLine accountingLine = IsDebitTestUtils
493:                        .getLiabilityLine(accountingDocument,
494:                                TargetAccountingLine.class, POSITIVE);
495:
496:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
497:                        .getBean(DocumentTypeService.class), SpringContext
498:                        .getBean(DataDictionaryService.class),
499:                        accountingDocument, accountingLine));
500:            }
501:
502:            /**
503:             * tests an <code>IllegalStateException</code> is thrown for a negative liability
504:             * 
505:             * @throws Exception
506:             */
507:            public void testIsDebit_target_liability_negativeAmount()
508:                    throws Exception {
509:                AccountingDocument accountingDocument = IsDebitTestUtils
510:                        .getDocument(SpringContext
511:                                .getBean(DocumentService.class),
512:                                DistributionOfIncomeAndExpenseDocument.class);
513:                AccountingLine accountingLine = IsDebitTestUtils
514:                        .getLiabilityLine(accountingDocument,
515:                                TargetAccountingLine.class, NEGATIVE);
516:
517:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
518:                        SpringContext.getBean(DocumentTypeService.class),
519:                        SpringContext.getBean(DataDictionaryService.class),
520:                        accountingDocument, accountingLine));
521:            }
522:
523:            /**
524:             * tests an <code>IllegalStateException</code> is thrown for a zero liability
525:             * 
526:             * @throws Exception
527:             */
528:            public void testIsDebit_target_liability_zeroAmount()
529:                    throws Exception {
530:                AccountingDocument accountingDocument = IsDebitTestUtils
531:                        .getDocument(SpringContext
532:                                .getBean(DocumentService.class),
533:                                DistributionOfIncomeAndExpenseDocument.class);
534:                AccountingLine accountingLine = IsDebitTestUtils
535:                        .getLiabilityLine(accountingDocument,
536:                                TargetAccountingLine.class, KualiDecimal.ZERO);
537:
538:                assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
539:                        SpringContext.getBean(DocumentTypeService.class),
540:                        SpringContext.getBean(DataDictionaryService.class),
541:                        accountingDocument, accountingLine));
542:            }
543:
544:            /**
545:             * tests false is returned for a negative income
546:             * 
547:             * @throws Exception
548:             */
549:            public void testIsDebit_errorCorrection_source_income_negativeAmount()
550:                    throws Exception {
551:                AccountingDocument accountingDocument = IsDebitTestUtils
552:                        .getErrorCorrectionDocument(SpringContext
553:                                .getBean(DocumentService.class),
554:                                DistributionOfIncomeAndExpenseDocument.class);
555:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
556:                        accountingDocument, SourceAccountingLine.class,
557:                        NEGATIVE);
558:
559:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
560:                        .getBean(DocumentTypeService.class), SpringContext
561:                        .getBean(DataDictionaryService.class),
562:                        accountingDocument, accountingLine));
563:            }
564:
565:            /**
566:             * tests true is returned for a negative expense
567:             * 
568:             * @throws Exception
569:             */
570:            public void testIsDebit_errorCorrection_source_expense_negativeAmount()
571:                    throws Exception {
572:                AccountingDocument accountingDocument = IsDebitTestUtils
573:                        .getErrorCorrectionDocument(SpringContext
574:                                .getBean(DocumentService.class),
575:                                DistributionOfIncomeAndExpenseDocument.class);
576:                AccountingLine accountingLine = IsDebitTestUtils
577:                        .getExpenseLine(accountingDocument,
578:                                SourceAccountingLine.class, NEGATIVE);
579:
580:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
581:                        .getBean(DocumentTypeService.class), SpringContext
582:                        .getBean(DataDictionaryService.class),
583:                        accountingDocument, accountingLine));
584:            }
585:
586:            /**
587:             * tests true is returned for a negative asset
588:             * 
589:             * @throws Exception
590:             */
591:            public void testIsDebit_errorCorrection_source_asset_negativeAmount()
592:                    throws Exception {
593:                AccountingDocument accountingDocument = IsDebitTestUtils
594:                        .getErrorCorrectionDocument(SpringContext
595:                                .getBean(DocumentService.class),
596:                                DistributionOfIncomeAndExpenseDocument.class);
597:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
598:                        accountingDocument, SourceAccountingLine.class,
599:                        NEGATIVE);
600:
601:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
602:                        .getBean(DocumentTypeService.class), SpringContext
603:                        .getBean(DataDictionaryService.class),
604:                        accountingDocument, accountingLine));
605:            }
606:
607:            /**
608:             * tests false is returned for a negative liability
609:             * 
610:             * @throws Exception
611:             */
612:            public void testIsDebit_errorCorrection_source_liability_negativeAmount()
613:                    throws Exception {
614:                AccountingDocument accountingDocument = IsDebitTestUtils
615:                        .getErrorCorrectionDocument(SpringContext
616:                                .getBean(DocumentService.class),
617:                                DistributionOfIncomeAndExpenseDocument.class);
618:                AccountingLine accountingLine = IsDebitTestUtils
619:                        .getLiabilityLine(accountingDocument,
620:                                SourceAccountingLine.class, NEGATIVE);
621:
622:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
623:                        .getBean(DocumentTypeService.class), SpringContext
624:                        .getBean(DataDictionaryService.class),
625:                        accountingDocument, accountingLine));
626:            }
627:
628:            /**
629:             * tests true is returned for a negative income
630:             * 
631:             * @throws Exception
632:             */
633:            public void testIsDebit_errorCorrection_target_income_negativeAmount()
634:                    throws Exception {
635:                AccountingDocument accountingDocument = IsDebitTestUtils
636:                        .getErrorCorrectionDocument(SpringContext
637:                                .getBean(DocumentService.class),
638:                                DistributionOfIncomeAndExpenseDocument.class);
639:                AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
640:                        accountingDocument, TargetAccountingLine.class,
641:                        NEGATIVE);
642:
643:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
644:                        .getBean(DocumentTypeService.class), SpringContext
645:                        .getBean(DataDictionaryService.class),
646:                        accountingDocument, accountingLine));
647:            }
648:
649:            /**
650:             * tests false is returned for a negative expense
651:             * 
652:             * @throws Exception
653:             */
654:            public void testIsDebit_errorCorrection_target_expense_negativeAmount()
655:                    throws Exception {
656:                AccountingDocument accountingDocument = IsDebitTestUtils
657:                        .getErrorCorrectionDocument(SpringContext
658:                                .getBean(DocumentService.class),
659:                                DistributionOfIncomeAndExpenseDocument.class);
660:                AccountingLine accountingLine = IsDebitTestUtils
661:                        .getExpenseLine(accountingDocument,
662:                                TargetAccountingLine.class, NEGATIVE);
663:
664:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
665:                        .getBean(DocumentTypeService.class), SpringContext
666:                        .getBean(DataDictionaryService.class),
667:                        accountingDocument, accountingLine));
668:            }
669:
670:            /**
671:             * tests false is returned for a negative asset
672:             * 
673:             * @throws Exception
674:             */
675:            public void testIsDebit_errorCorrection_target_asset_negativeAmount()
676:                    throws Exception {
677:                AccountingDocument accountingDocument = IsDebitTestUtils
678:                        .getErrorCorrectionDocument(SpringContext
679:                                .getBean(DocumentService.class),
680:                                DistributionOfIncomeAndExpenseDocument.class);
681:                AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
682:                        accountingDocument, TargetAccountingLine.class,
683:                        NEGATIVE);
684:
685:                assertFalse(IsDebitTestUtils.isDebit(SpringContext
686:                        .getBean(DocumentTypeService.class), SpringContext
687:                        .getBean(DataDictionaryService.class),
688:                        accountingDocument, accountingLine));
689:            }
690:
691:            /**
692:             * tests true is returned for a negative liability
693:             * 
694:             * @throws Exception
695:             */
696:            public void testIsDebit_errorCorrection_target_liability_negativeAmount()
697:                    throws Exception {
698:                AccountingDocument accountingDocument = IsDebitTestUtils
699:                        .getErrorCorrectionDocument(SpringContext
700:                                .getBean(DocumentService.class),
701:                                DistributionOfIncomeAndExpenseDocument.class);
702:                AccountingLine accountingLine = IsDebitTestUtils
703:                        .getLiabilityLine(accountingDocument,
704:                                TargetAccountingLine.class, NEGATIVE);
705:
706:                assertTrue(IsDebitTestUtils.isDebit(SpringContext
707:                        .getBean(DocumentTypeService.class), SpringContext
708:                        .getBean(DataDictionaryService.class),
709:                        accountingDocument, accountingLine));
710:            }
711:
712:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.