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


001:        /*
002:         * Copyright 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.bo;
017:
018:        import org.kuali.core.util.KualiDecimal;
019:        import org.kuali.kfs.context.KualiTestBase;
020:
021:        public class CurrencyDetailTest extends KualiTestBase {
022:            public enum CurrencyDetailAmountFixture {
023:                GOOD_POSITIVE_AMOUNT(500.0, 250.0, 100.0, 50.0, 25.0, 10.0, 5.0), BAD_POSITIVE_AMOUNT(
024:                        367.0, 367.0, 367.0, 367.0, 367.0, 367.0, 367.5), ALL_FIVES_AMOUNT(
025:                        500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0), NULL_AMOUNT, ZERO_AMOUNT(
026:                        0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), NEGATIVE_AMOUNT(
027:                        -500.0, -500.0, -500.0, -500.0, -500.0, -500.0, -500.0), ALL_TENS_AMOUNT(
028:                        1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0);
029:
030:                private KualiDecimal hundredDollarAmount;
031:                private KualiDecimal fiftyDollarAmount;
032:                private KualiDecimal twentyDollarAmount;
033:                private KualiDecimal tenDollarAmount;
034:                private KualiDecimal fiveDollarAmount;
035:                private KualiDecimal twoDollarAmount;
036:                private KualiDecimal oneDollarAmount;
037:
038:                private CurrencyDetailAmountFixture() {
039:                }
040:
041:                private CurrencyDetailAmountFixture(double hundredDollarAmount,
042:                        double fiftyDollarAmount, double twentyDollarAmount,
043:                        double tenDollarAmount, double fiveDollarAmount,
044:                        double twoDollarAmount, double oneDollarAmount) {
045:                    this .hundredDollarAmount = new KualiDecimal(
046:                            hundredDollarAmount);
047:                    this .fiftyDollarAmount = new KualiDecimal(fiftyDollarAmount);
048:                    this .twentyDollarAmount = new KualiDecimal(
049:                            twentyDollarAmount);
050:                    this .tenDollarAmount = new KualiDecimal(tenDollarAmount);
051:                    this .fiveDollarAmount = new KualiDecimal(fiveDollarAmount);
052:                    this .twoDollarAmount = new KualiDecimal(twoDollarAmount);
053:                    this .oneDollarAmount = new KualiDecimal(oneDollarAmount);
054:                }
055:
056:                public CurrencyDetail convertToCurrencyDetail() {
057:                    CurrencyDetail detail = new CurrencyDetail();
058:                    detail
059:                            .setFinancialDocumentHundredDollarAmount(this .hundredDollarAmount);
060:                    detail
061:                            .setFinancialDocumentFiftyDollarAmount(this .fiftyDollarAmount);
062:                    detail
063:                            .setFinancialDocumentTwentyDollarAmount(this .twentyDollarAmount);
064:                    detail
065:                            .setFinancialDocumentTenDollarAmount(this .tenDollarAmount);
066:                    detail
067:                            .setFinancialDocumentFiveDollarAmount(this .fiveDollarAmount);
068:                    detail
069:                            .setFinancialDocumentTwoDollarAmount(this .twoDollarAmount);
070:                    detail
071:                            .setFinancialDocumentOneDollarAmount(this .oneDollarAmount);
072:
073:                    return detail;
074:                }
075:            }
076:
077:            public enum CurrencyDetailCountFixture {
078:                GOOD_POSITIVE_COUNT(new Integer(5), new Integer(10),
079:                        new Integer(25), new Integer(50), new Integer(100),
080:                        new Integer(250), new Integer(500)), ALL_FIVE_HUNDREDS_COUNT(
081:                        new Integer(5), new Integer(5), new Integer(5),
082:                        new Integer(5), new Integer(5), new Integer(5),
083:                        new Integer(5)), NULL_COUNT, ZERO_COUNT(new Integer(0),
084:                        new Integer(0), new Integer(0), new Integer(0),
085:                        new Integer(0), new Integer(0), new Integer(0)), NEGATIVE_COUNT(
086:                        new Integer(-5), new Integer(-5), new Integer(-5),
087:                        new Integer(-5), new Integer(-5), new Integer(-5),
088:                        new Integer(-5));
089:
090:                private Integer hundredDollarCount;
091:                private Integer fiftyDollarCount;
092:                private Integer twentyDollarCount;
093:                private Integer tenDollarCount;
094:                private Integer fiveDollarCount;
095:                private Integer twoDollarCount;
096:                private Integer oneDollarCount;
097:
098:                private CurrencyDetailCountFixture() {
099:                }
100:
101:                private CurrencyDetailCountFixture(Integer hundredDollarCount,
102:                        Integer fiftyDollarCount, Integer twentyDollarCount,
103:                        Integer tenDollarCount, Integer fiveDollarCount,
104:                        Integer twoDollarCount, Integer oneDollarCount) {
105:                    this .hundredDollarCount = hundredDollarCount;
106:                    this .fiftyDollarCount = fiftyDollarCount;
107:                    this .twentyDollarCount = twentyDollarCount;
108:                    this .tenDollarCount = tenDollarCount;
109:                    this .fiveDollarCount = fiveDollarCount;
110:                    this .twoDollarCount = twoDollarCount;
111:                    this .oneDollarCount = oneDollarCount;
112:                }
113:
114:                public CurrencyDetail convertToCurrencyDetail() {
115:                    CurrencyDetail detail = new CurrencyDetail();
116:                    detail.setHundredDollarCount(this .hundredDollarCount);
117:                    detail.setFiftyDollarCount(this .fiftyDollarCount);
118:                    detail.setTwentyDollarCount(this .twentyDollarCount);
119:                    detail.setTenDollarCount(this .tenDollarCount);
120:                    detail.setFiveDollarCount(this .fiveDollarCount);
121:                    detail.setTwoDollarCount(this .twoDollarCount);
122:                    detail.setOneDollarCount(this .oneDollarCount);
123:
124:                    return detail;
125:                }
126:            }
127:
128:            public void testAmountToCountConversion() {
129:                CurrencyDetail goodAmount = CurrencyDetailAmountFixture.GOOD_POSITIVE_AMOUNT
130:                        .convertToCurrencyDetail();
131:                assertEquals(goodAmount.getHundredDollarCount(), new Integer(5));
132:                assertEquals(goodAmount.getFiftyDollarCount(), new Integer(5));
133:                assertEquals(goodAmount.getTwentyDollarCount(), new Integer(5));
134:                assertEquals(goodAmount.getTenDollarCount(), new Integer(5));
135:                assertEquals(goodAmount.getFiveDollarCount(), new Integer(5));
136:                assertEquals(goodAmount.getTwoDollarCount(), new Integer(5));
137:                assertEquals(goodAmount.getOneDollarCount(), new Integer(5));
138:            }
139:
140:            public void testCountToAmountConversion() {
141:                CurrencyDetail goodCount = CurrencyDetailCountFixture.GOOD_POSITIVE_COUNT
142:                        .convertToCurrencyDetail();
143:                assertEquals(goodCount
144:                        .getFinancialDocumentHundredDollarAmount(),
145:                        new KualiDecimal(500));
146:                assertEquals(goodCount.getFinancialDocumentFiftyDollarAmount(),
147:                        new KualiDecimal(500));
148:                assertEquals(
149:                        goodCount.getFinancialDocumentTwentyDollarAmount(),
150:                        new KualiDecimal(500));
151:                assertEquals(goodCount.getFinancialDocumentTenDollarAmount(),
152:                        new KualiDecimal(500));
153:                assertEquals(goodCount.getFinancialDocumentFiveDollarAmount(),
154:                        new KualiDecimal(500));
155:                assertEquals(goodCount.getFinancialDocumentTwoDollarAmount(),
156:                        new KualiDecimal(500));
157:                assertEquals(goodCount.getFinancialDocumentOneDollarAmount(),
158:                        new KualiDecimal(500));
159:            }
160:
161:            public void testZeroOutAmounts() {
162:                CurrencyDetail zeroAmountControl = CurrencyDetailAmountFixture.ZERO_AMOUNT
163:                        .convertToCurrencyDetail();
164:                CurrencyDetail zeroAmount = CurrencyDetailAmountFixture.ZERO_AMOUNT
165:                        .convertToCurrencyDetail();
166:                CurrencyDetail nullAmount = CurrencyDetailAmountFixture.NULL_AMOUNT
167:                        .convertToCurrencyDetail();
168:                CurrencyDetail goodAmount = CurrencyDetailAmountFixture.GOOD_POSITIVE_AMOUNT
169:                        .convertToCurrencyDetail();
170:                CurrencyDetail negativeAmount = CurrencyDetailAmountFixture.NEGATIVE_AMOUNT
171:                        .convertToCurrencyDetail();
172:
173:                zeroAmount.zeroOutAmounts();
174:                assertDetailAmountsEqual(zeroAmount, zeroAmountControl);
175:                nullAmount.zeroOutAmounts();
176:                assertDetailAmountsEqual(nullAmount, zeroAmountControl);
177:                goodAmount.zeroOutAmounts();
178:                assertDetailAmountsEqual(goodAmount, zeroAmountControl);
179:                negativeAmount.zeroOutAmounts();
180:                assertDetailAmountsEqual(negativeAmount, zeroAmountControl);
181:
182:                CurrencyDetail goodCount = CurrencyDetailCountFixture.GOOD_POSITIVE_COUNT
183:                        .convertToCurrencyDetail();
184:                CurrencyDetail zeroCount = CurrencyDetailCountFixture.ZERO_COUNT
185:                        .convertToCurrencyDetail();
186:                CurrencyDetail negativeCount = CurrencyDetailCountFixture.NEGATIVE_COUNT
187:                        .convertToCurrencyDetail();
188:                CurrencyDetail nullCount = CurrencyDetailCountFixture.NULL_COUNT
189:                        .convertToCurrencyDetail();
190:
191:                zeroCount.zeroOutAmounts();
192:                assertDetailAmountsEqual(zeroCount, zeroAmountControl);
193:                nullCount.zeroOutAmounts();
194:                assertDetailAmountsEqual(nullCount, zeroAmountControl);
195:                goodCount.zeroOutAmounts();
196:                assertDetailAmountsEqual(goodCount, zeroAmountControl);
197:                negativeCount.zeroOutAmounts();
198:                assertDetailAmountsEqual(negativeCount, zeroAmountControl);
199:            }
200:
201:            public void testZeroOutUnpopulatedAmounts() {
202:                CurrencyDetail zeroAmountControl = CurrencyDetailAmountFixture.ZERO_AMOUNT
203:                        .convertToCurrencyDetail();
204:                CurrencyDetail zeroAmount = CurrencyDetailAmountFixture.ZERO_AMOUNT
205:                        .convertToCurrencyDetail();
206:                CurrencyDetail nullAmount = CurrencyDetailAmountFixture.NULL_AMOUNT
207:                        .convertToCurrencyDetail();
208:                CurrencyDetail goodAmount = CurrencyDetailAmountFixture.GOOD_POSITIVE_AMOUNT
209:                        .convertToCurrencyDetail();
210:
211:                zeroAmount.zeroOutUnpopulatedAmounts();
212:                assertDetailAmountsEqual(zeroAmount, zeroAmountControl);
213:                nullAmount.zeroOutUnpopulatedAmounts();
214:                assertDetailAmountsEqual(nullAmount, zeroAmountControl);
215:                goodAmount.zeroOutUnpopulatedAmounts();
216:                assertDetailAmountsNotEqual(goodAmount, zeroAmountControl);
217:
218:                goodAmount.setFinancialDocumentHundredDollarAmount(null);
219:                goodAmount.setFinancialDocumentTwentyDollarAmount(null);
220:                goodAmount.setFinancialDocumentFiveDollarAmount(null);
221:                goodAmount.setFinancialDocumentTwoDollarAmount(null);
222:                CurrencyDetail semiPopulatedAmount = CurrencyDetailAmountFixture.GOOD_POSITIVE_AMOUNT
223:                        .convertToCurrencyDetail();
224:                semiPopulatedAmount
225:                        .setFinancialDocumentHundredDollarAmount(new KualiDecimal(
226:                                0));
227:                semiPopulatedAmount
228:                        .setFinancialDocumentTwentyDollarAmount(new KualiDecimal(
229:                                0));
230:                semiPopulatedAmount
231:                        .setFinancialDocumentFiveDollarAmount(new KualiDecimal(
232:                                0));
233:                semiPopulatedAmount
234:                        .setFinancialDocumentTwoDollarAmount(new KualiDecimal(0));
235:                goodAmount.zeroOutUnpopulatedAmounts();
236:                assertDetailAmountsEqual(goodAmount, semiPopulatedAmount);
237:
238:                CurrencyDetail goodCount = CurrencyDetailCountFixture.GOOD_POSITIVE_COUNT
239:                        .convertToCurrencyDetail();
240:                CurrencyDetail zeroCount = CurrencyDetailCountFixture.ZERO_COUNT
241:                        .convertToCurrencyDetail();
242:                CurrencyDetail nullCount = CurrencyDetailCountFixture.NULL_COUNT
243:                        .convertToCurrencyDetail();
244:
245:                zeroCount.zeroOutUnpopulatedAmounts();
246:                assertDetailAmountsEqual(zeroCount, zeroAmountControl);
247:                nullCount.zeroOutUnpopulatedAmounts();
248:                assertDetailAmountsEqual(nullCount, zeroAmountControl);
249:                goodCount.zeroOutUnpopulatedAmounts();
250:                assertDetailAmountsNotEqual(goodCount, zeroAmountControl);
251:            }
252:
253:            public void testAdd() {
254:                CurrencyDetail zeroAmountControl = CurrencyDetailAmountFixture.ZERO_AMOUNT
255:                        .convertToCurrencyDetail();
256:                CurrencyDetail zeroAmount = CurrencyDetailAmountFixture.ZERO_AMOUNT
257:                        .convertToCurrencyDetail();
258:                CurrencyDetail nullAmount = CurrencyDetailAmountFixture.NULL_AMOUNT
259:                        .convertToCurrencyDetail();
260:                CurrencyDetail goodAmountControl = CurrencyDetailAmountFixture.ALL_FIVES_AMOUNT
261:                        .convertToCurrencyDetail();
262:                CurrencyDetail goodAmount = CurrencyDetailAmountFixture.ALL_FIVES_AMOUNT
263:                        .convertToCurrencyDetail();
264:                CurrencyDetail negativeAmountControl = CurrencyDetailAmountFixture.NEGATIVE_AMOUNT
265:                        .convertToCurrencyDetail();
266:                CurrencyDetail negativeAmount = CurrencyDetailAmountFixture.NEGATIVE_AMOUNT
267:                        .convertToCurrencyDetail();
268:
269:                zeroAmount.add(zeroAmountControl);
270:                assertDetailAmountsEqual(zeroAmount, zeroAmountControl);
271:                nullAmount.add(zeroAmountControl);
272:                assertDetailAmountsEqual(nullAmount, zeroAmountControl);
273:                goodAmount.add(zeroAmountControl);
274:                assertDetailAmountsEqual(goodAmount, goodAmountControl);
275:                negativeAmount.add(zeroAmountControl);
276:                assertDetailAmountsEqual(negativeAmount, negativeAmountControl);
277:                goodAmount.add(negativeAmount);
278:                assertDetailAmountsEqual(goodAmount, zeroAmountControl);
279:            }
280:
281:            public void testSubtract() {
282:                CurrencyDetail zeroAmountControl = CurrencyDetailAmountFixture.ZERO_AMOUNT
283:                        .convertToCurrencyDetail();
284:                CurrencyDetail zeroAmount = CurrencyDetailAmountFixture.ZERO_AMOUNT
285:                        .convertToCurrencyDetail();
286:                CurrencyDetail nullAmount = CurrencyDetailAmountFixture.NULL_AMOUNT
287:                        .convertToCurrencyDetail();
288:                CurrencyDetail goodAmountControl = CurrencyDetailAmountFixture.ALL_FIVES_AMOUNT
289:                        .convertToCurrencyDetail();
290:                CurrencyDetail goodAmount = CurrencyDetailAmountFixture.ALL_FIVES_AMOUNT
291:                        .convertToCurrencyDetail();
292:                CurrencyDetail negativeAmountControl = CurrencyDetailAmountFixture.NEGATIVE_AMOUNT
293:                        .convertToCurrencyDetail();
294:                CurrencyDetail negativeAmount = CurrencyDetailAmountFixture.NEGATIVE_AMOUNT
295:                        .convertToCurrencyDetail();
296:
297:                zeroAmount.subtract(zeroAmountControl);
298:                assertDetailAmountsEqual(zeroAmount, zeroAmountControl);
299:                nullAmount.subtract(zeroAmountControl);
300:                assertDetailAmountsEqual(nullAmount, zeroAmountControl);
301:                goodAmount.subtract(zeroAmountControl);
302:                assertDetailAmountsEqual(goodAmount, goodAmountControl);
303:                negativeAmount.subtract(zeroAmountControl);
304:                assertDetailAmountsEqual(negativeAmount, negativeAmountControl);
305:
306:                CurrencyDetail doublePositives = new CurrencyDetail();
307:                doublePositives
308:                        .setFinancialDocumentHundredDollarAmount(goodAmount
309:                                .getFinancialDocumentHundredDollarAmount()
310:                                .multiply(new KualiDecimal(2.0)));
311:                doublePositives
312:                        .setFinancialDocumentFiftyDollarAmount(goodAmount
313:                                .getFinancialDocumentFiftyDollarAmount()
314:                                .multiply(new KualiDecimal(2.0)));
315:                doublePositives
316:                        .setFinancialDocumentTwentyDollarAmount(goodAmount
317:                                .getFinancialDocumentTwentyDollarAmount()
318:                                .multiply(new KualiDecimal(2.0)));
319:                doublePositives.setFinancialDocumentTenDollarAmount(goodAmount
320:                        .getFinancialDocumentTenDollarAmount().multiply(
321:                                new KualiDecimal(2.0)));
322:                doublePositives.setFinancialDocumentFiveDollarAmount(goodAmount
323:                        .getFinancialDocumentFiveDollarAmount().multiply(
324:                                new KualiDecimal(2.0)));
325:                doublePositives.setFinancialDocumentTwoDollarAmount(goodAmount
326:                        .getFinancialDocumentTwoDollarAmount().multiply(
327:                                new KualiDecimal(2.0)));
328:                doublePositives.setFinancialDocumentOneDollarAmount(goodAmount
329:                        .getFinancialDocumentOneDollarAmount().multiply(
330:                                new KualiDecimal(2.0)));
331:                goodAmount.subtract(negativeAmount);
332:                assertDetailAmountsEqual(goodAmount, doublePositives);
333:
334:                negativeAmount = CurrencyDetailAmountFixture.NEGATIVE_AMOUNT
335:                        .convertToCurrencyDetail();
336:                goodAmount = CurrencyDetailAmountFixture.ALL_FIVES_AMOUNT
337:                        .convertToCurrencyDetail();
338:                CurrencyDetail doubleNegatives = new CurrencyDetail();
339:                doubleNegatives
340:                        .setFinancialDocumentHundredDollarAmount(negativeAmount
341:                                .getFinancialDocumentHundredDollarAmount()
342:                                .multiply(new KualiDecimal(2.0)));
343:                doubleNegatives
344:                        .setFinancialDocumentFiftyDollarAmount(negativeAmount
345:                                .getFinancialDocumentFiftyDollarAmount()
346:                                .multiply(new KualiDecimal(2.0)));
347:                doubleNegatives
348:                        .setFinancialDocumentTwentyDollarAmount(negativeAmount
349:                                .getFinancialDocumentTwentyDollarAmount()
350:                                .multiply(new KualiDecimal(2.0)));
351:                doubleNegatives
352:                        .setFinancialDocumentTenDollarAmount(negativeAmount
353:                                .getFinancialDocumentTenDollarAmount()
354:                                .multiply(new KualiDecimal(2.0)));
355:                doubleNegatives
356:                        .setFinancialDocumentFiveDollarAmount(negativeAmount
357:                                .getFinancialDocumentFiveDollarAmount()
358:                                .multiply(new KualiDecimal(2.0)));
359:                doubleNegatives
360:                        .setFinancialDocumentTwoDollarAmount(negativeAmount
361:                                .getFinancialDocumentTwoDollarAmount()
362:                                .multiply(new KualiDecimal(2.0)));
363:                doubleNegatives
364:                        .setFinancialDocumentOneDollarAmount(negativeAmount
365:                                .getFinancialDocumentOneDollarAmount()
366:                                .multiply(new KualiDecimal(2.0)));
367:                negativeAmount.subtract(goodAmount);
368:                assertDetailAmountsEqual(negativeAmount, doubleNegatives);
369:            }
370:
371:            public void testTotal() {
372:                CurrencyDetail zeroAmount = CurrencyDetailAmountFixture.ZERO_AMOUNT
373:                        .convertToCurrencyDetail();
374:                assertEquals(zeroAmount.getTotalAmount(), new KualiDecimal(0.0));
375:                CurrencyDetail nullAmount = CurrencyDetailAmountFixture.NULL_AMOUNT
376:                        .convertToCurrencyDetail();
377:                assertEquals(nullAmount.getTotalAmount(), new KualiDecimal(0.0));
378:
379:                CurrencyDetail goodAmount = CurrencyDetailAmountFixture.GOOD_POSITIVE_AMOUNT
380:                        .convertToCurrencyDetail();
381:                assertEquals(goodAmount.getTotalAmount(), new KualiDecimal(
382:                        940.0));
383:                CurrencyDetail negativeAmount = CurrencyDetailAmountFixture.NEGATIVE_AMOUNT
384:                        .convertToCurrencyDetail();
385:                assertEquals(negativeAmount.getTotalAmount(), new KualiDecimal(
386:                        -3500.0));
387:            }
388:
389:            public void testIsEmpty() {
390:                CurrencyDetail zeroAmount = CurrencyDetailAmountFixture.ZERO_AMOUNT
391:                        .convertToCurrencyDetail();
392:                assertTrue(zeroAmount.isEmpty());
393:                CurrencyDetail nullAmount = CurrencyDetailAmountFixture.NULL_AMOUNT
394:                        .convertToCurrencyDetail();
395:                assertTrue(nullAmount.isEmpty());
396:
397:                CurrencyDetail goodAmount = CurrencyDetailAmountFixture.GOOD_POSITIVE_AMOUNT
398:                        .convertToCurrencyDetail();
399:                assertFalse(goodAmount.isEmpty());
400:                CurrencyDetail negativeAmount = CurrencyDetailAmountFixture.NEGATIVE_AMOUNT
401:                        .convertToCurrencyDetail();
402:                assertFalse(negativeAmount.isEmpty());
403:            }
404:
405:            private void assertDetailAmountsEqual(CurrencyDetail tweedleDee,
406:                    CurrencyDetail tweedleDum) {
407:                assertEquals(tweedleDee
408:                        .getFinancialDocumentHundredDollarAmount(), tweedleDum
409:                        .getFinancialDocumentHundredDollarAmount());
410:                assertEquals(
411:                        tweedleDee.getFinancialDocumentFiftyDollarAmount(),
412:                        tweedleDum.getFinancialDocumentFiftyDollarAmount());
413:                assertEquals(tweedleDee
414:                        .getFinancialDocumentTwentyDollarAmount(), tweedleDum
415:                        .getFinancialDocumentTwentyDollarAmount());
416:                assertEquals(tweedleDee.getFinancialDocumentTenDollarAmount(),
417:                        tweedleDum.getFinancialDocumentTenDollarAmount());
418:                assertEquals(tweedleDee.getFinancialDocumentFiveDollarAmount(),
419:                        tweedleDum.getFinancialDocumentFiveDollarAmount());
420:                assertEquals(tweedleDee.getFinancialDocumentTwoDollarAmount(),
421:                        tweedleDum.getFinancialDocumentTwoDollarAmount());
422:                assertEquals(tweedleDee.getFinancialDocumentOneDollarAmount(),
423:                        tweedleDum.getFinancialDocumentOneDollarAmount());
424:            }
425:
426:            public void assertDetailAmountsNotEqual(CurrencyDetail tweedleDee,
427:                    CurrencyDetail tweedleDum) {
428:                assertFalse(tweedleDee
429:                        .getFinancialDocumentHundredDollarAmount()
430:                        .equals(
431:                                tweedleDum
432:                                        .getFinancialDocumentHundredDollarAmount()));
433:                assertFalse(tweedleDee
434:                        .getFinancialDocumentFiftyDollarAmount()
435:                        .equals(
436:                                tweedleDum
437:                                        .getFinancialDocumentFiftyDollarAmount()));
438:                assertFalse(tweedleDee
439:                        .getFinancialDocumentTwentyDollarAmount()
440:                        .equals(
441:                                tweedleDum
442:                                        .getFinancialDocumentTwentyDollarAmount()));
443:                assertFalse(tweedleDee.getFinancialDocumentTenDollarAmount()
444:                        .equals(
445:                                tweedleDum
446:                                        .getFinancialDocumentTenDollarAmount()));
447:                assertFalse(tweedleDee
448:                        .getFinancialDocumentFiveDollarAmount()
449:                        .equals(
450:                                tweedleDum
451:                                        .getFinancialDocumentFiveDollarAmount()));
452:                assertFalse(tweedleDee.getFinancialDocumentTwoDollarAmount()
453:                        .equals(
454:                                tweedleDum
455:                                        .getFinancialDocumentTwoDollarAmount()));
456:                assertFalse(tweedleDee.getFinancialDocumentOneDollarAmount()
457:                        .equals(
458:                                tweedleDum
459:                                        .getFinancialDocumentOneDollarAmount()));
460:            }
461:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.