Source Code Cross Referenced for VendorRuleTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » vendor » 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.vendor.rules 
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.vendor.rules;
017:
018:        import static org.kuali.test.fixtures.UserNameFixture.KHUNTLEY;
019:
020:        import java.util.List;
021:
022:        import org.kuali.core.document.MaintenanceDocument;
023:        import org.kuali.core.maintenance.MaintenanceRuleTestBase;
024:        import org.kuali.module.vendor.bo.VendorAddress;
025:        import org.kuali.module.vendor.bo.VendorContract;
026:        import org.kuali.module.vendor.bo.VendorDetail;
027:        import org.kuali.module.vendor.fixtures.VendorContractBeginEndDatesFixture;
028:        import org.kuali.module.vendor.fixtures.VendorContractPurchaseOrderLimitAmountPresenceFixture;
029:        import org.kuali.module.vendor.fixtures.VendorRuleAddressStateZipFixture;
030:        import org.kuali.module.vendor.fixtures.VendorRuleAddressTypeFixture;
031:        import org.kuali.module.vendor.fixtures.VendorRuleFaxNumberFixture;
032:        import org.kuali.test.ConfigureContext;
033:
034:        /**
035:         * This class should contain all tests of methods implementing Vendor rules. For this purpose, we need to set up the parts of a
036:         * MaintenanceDocument.
037:         */
038:        @ConfigureContext(session=KHUNTLEY)
039:        public class VendorRuleTest extends MaintenanceRuleTestBase {
040:
041:            private VendorDetail oldVendor;
042:            private VendorDetail newVendor;
043:            private MaintenanceDocument maintDoc;
044:            private VendorRule rule;
045:
046:            private String taxNumber = "111222333";
047:            private String taxType = "test";
048:            private String taxTypeCode = "TC";
049:
050:            private String name = "testName";
051:
052:            @Override
053:            protected void setUp() throws Exception {
054:                super .setUp();
055:                oldVendor = new VendorDetail();
056:                newVendor = new VendorDetail();
057:                maintDoc = newMaintDoc(oldVendor, newVendor);
058:                VendorRule rule = (VendorRule) setupMaintDocRule(maintDoc,
059:                        VendorRule.class);
060:            }
061:
062:            @Override
063:            protected void tearDown() throws Exception {
064:                oldVendor = null;
065:                newVendor = null;
066:                maintDoc = null;
067:                rule = null;
068:                super .tearDown();
069:            }
070:
071:            /*
072:             * TESTS OF ValidateTaxTypeAndTaxNumberBlankness
073:             */
074:            public void testValidateTaxTypeAndTaxNumberBlankness_NullTaxType() {
075:                newVendor.getVendorHeader().setVendorTaxNumber(taxNumber);
076:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
077:                        VendorRule.class);
078:                rule.refreshSubObjects(newVendor);
079:                assertFalse(rule
080:                        .validateTaxTypeAndTaxNumberBlankness(newVendor));
081:            }
082:
083:            public void testValidateTaxTypeAndTaxNumberBlankness_EmptyStrTaxType() {
084:                newVendor.getVendorHeader().setVendorTaxNumber(taxNumber);
085:                newVendor.getVendorHeader().setVendorTaxTypeCode("");
086:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
087:                        VendorRule.class);
088:                rule.refreshSubObjects(newVendor);
089:                assertFalse(rule
090:                        .validateTaxTypeAndTaxNumberBlankness(newVendor));
091:            }
092:
093:            public void testValidateTaxTypeAndTaxNumberBlankness_WithTaxType() {
094:                newVendor.getVendorHeader().setVendorTaxNumber(taxNumber);
095:                newVendor.getVendorHeader().setVendorTaxTypeCode(taxTypeCode);
096:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
097:                        VendorRule.class);
098:                rule.refreshSubObjects(newVendor);
099:                assertTrue(rule.validateTaxTypeAndTaxNumberBlankness(newVendor));
100:            }
101:
102:            public void testValidateTaxTypeAndTaxNumberBlankness_NullTaxNumber() {
103:                newVendor.getVendorHeader().setVendorTaxTypeCode(taxTypeCode);
104:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
105:                        VendorRule.class);
106:                rule.refreshSubObjects(newVendor);
107:                assertFalse(rule
108:                        .validateTaxTypeAndTaxNumberBlankness(newVendor));
109:            }
110:
111:            public void testValidateTaxTypeAndTaxNumberBlankness_EmptyStrTaxNumber() {
112:                newVendor.getVendorHeader().setVendorTaxNumber("");
113:                newVendor.getVendorHeader().setVendorTaxTypeCode(taxTypeCode);
114:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
115:                        VendorRule.class);
116:                rule.refreshSubObjects(newVendor);
117:                assertFalse(rule
118:                        .validateTaxTypeAndTaxNumberBlankness(newVendor));
119:            }
120:
121:            /*
122:             * TESTS OF ValidateVendorNames
123:             */
124:
125:            public void testValidateVendorNames_NoNames() {
126:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
127:                        VendorRule.class);
128:                rule.refreshSubObjects(newVendor);
129:                assertFalse(rule.validateVendorNames(newVendor));
130:            }
131:
132:            public void testValidateVendorNames_WithVendorName() {
133:                newVendor.setVendorName(name);
134:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
135:                        VendorRule.class);
136:                rule.refreshSubObjects(newVendor);
137:                assertTrue(rule.validateVendorNames(newVendor));
138:            }
139:
140:            public void testValidateVendorNames_EmptyStrVendorName() {
141:                newVendor.setVendorName("");
142:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
143:                        VendorRule.class);
144:                rule.refreshSubObjects(newVendor);
145:                assertFalse(rule.validateVendorNames(newVendor));
146:            }
147:
148:            public void testValidateVendorNames_WithFirstAndLast() {
149:                newVendor.setVendorFirstName(name);
150:                newVendor.setVendorLastName(name);
151:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
152:                        VendorRule.class);
153:                rule.refreshSubObjects(newVendor);
154:                assertTrue(rule.validateVendorNames(newVendor));
155:            }
156:
157:            public void testValidateVendorNames_EmptyStrFirstLast() {
158:                newVendor.setVendorFirstName("");
159:                newVendor.setVendorLastName(name);
160:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
161:                        VendorRule.class);
162:                rule.refreshSubObjects(newVendor);
163:                assertFalse(rule.validateVendorNames(newVendor));
164:            }
165:
166:            public void testValidateVendorNames_BothKinds() {
167:                newVendor.setVendorName(name);
168:                newVendor.setVendorFirstName(name);
169:                newVendor.setVendorLastName(name);
170:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
171:                        VendorRule.class);
172:                rule.refreshSubObjects(newVendor);
173:                assertFalse(rule.validateVendorNames(newVendor));
174:            }
175:
176:            public void testValidateVendorNames_HalfBoth() {
177:                newVendor.setVendorName(name);
178:                newVendor.setVendorFirstName(name);
179:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
180:                        VendorRule.class);
181:                rule.refreshSubObjects(newVendor);
182:                assertFalse(rule.validateVendorNames(newVendor));
183:            }
184:
185:            /**
186:             * This method does the setup for the tests which examine the implementation of the requirement that certain vendor type codes
187:             * require certain address type codes. Address type codes are in the collection of VendorAddresses.
188:             * 
189:             * @param typeCode A VendorTypeCode, which here could be any String
190:             * @param addrTypeCode1 A VendorAddressTypeCode, which here could be any String
191:             * @param addrTypeCode2 The VendorAddressTypeCode for the second VendorAddress of the collection
192:             */
193:            protected VendorRule validateAddressType_TestHelper(
194:                    VendorRuleAddressTypeFixture vratf) {
195:                newVendor = vratf.populateVendor(newVendor);
196:                maintDoc = newMaintDoc(oldVendor, newVendor);
197:                VendorRule rule = (VendorRule) setupMaintDocRule(maintDoc,
198:                        VendorRule.class);
199:                rule.refreshSubObjects(newVendor);
200:                return rule;
201:            }
202:
203:            public void testProcessAddressValidation_WithPOTypeAndPOAddrTypes() {
204:                rule = validateAddressType_TestHelper(VendorRuleAddressTypeFixture.WITH_PO_TYPE_AND_PO_ADDR_TYPES);
205:                assertTrue(rule.processAddressValidation(maintDoc));
206:            }
207:
208:            public void testProcessAddressValidation_WithDVTypeAndRMAddrTypes() {
209:                rule = validateAddressType_TestHelper(VendorRuleAddressTypeFixture.WITH_DV_TYPE_AND_RM_ADDR_TYPES);
210:                assertTrue(rule.processAddressValidation(maintDoc));
211:            }
212:
213:            public void testProcessAddressValidation_WithPOTypeAndRMAddrTypes() {
214:                rule = validateAddressType_TestHelper(VendorRuleAddressTypeFixture.WITH_PO_TYPE_AND_RM_ADDR_TYPES);
215:                assertFalse(rule.processAddressValidation(maintDoc));
216:            }
217:
218:            public void testProcessAddressValidation_WithPOTypeAndOnePOAndOneRMAddrTypes() {
219:                rule = validateAddressType_TestHelper(VendorRuleAddressTypeFixture.WITH_PO_TYPE_AND_ONE_PO_AND_ONE_RM_ADDR_TYPES);
220:                assertTrue(rule.processAddressValidation(maintDoc));
221:            }
222:
223:            /*
224:             * TESTS OF checkAddressCountryEmptyStateZip
225:             */
226:            public void testCheckAddressCountryEmptyStateZip_WithUSWithBothStatesWithBothZips() {
227:                List<VendorAddress> addrList = VendorRuleAddressStateZipFixture.BOTH_US_BOTH_STATES_BOTH_ZIPS
228:                        .populateAddresses();
229:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
230:                        VendorRule.class);
231:                rule.refreshSubObjects(newVendor);
232:                int i = 0;
233:                for (VendorAddress address : addrList) {
234:                    i++;
235:                    assertTrue(rule.checkAddressCountryEmptyStateZip(address));
236:                }
237:            }
238:
239:            public void testCheckAddressCountryEmptyStateZip_WithUSWithoutStatesWithoutZips() {
240:                List<VendorAddress> addrList = VendorRuleAddressStateZipFixture.BOTH_US_WITHOUT_STATES_WITHOUT_ZIPS
241:                        .populateAddresses();
242:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
243:                        VendorRule.class);
244:                rule.refreshSubObjects(newVendor);
245:                int i = 0;
246:                for (VendorAddress address : addrList) {
247:                    i++;
248:                    assertFalse(rule.checkAddressCountryEmptyStateZip(address));
249:                }
250:            }
251:
252:            public void testCheckAddressCountryEmptyStateZip_WithUSWithEmptyStatesEmptyZips() {
253:                List<VendorAddress> addrList = VendorRuleAddressStateZipFixture.BOTH_US_EMPTY_STATES_EMPTY_ZIPS
254:                        .populateAddresses();
255:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
256:                        VendorRule.class);
257:                rule.refreshSubObjects(newVendor);
258:                int i = 0;
259:                for (VendorAddress address : addrList) {
260:                    i++;
261:                    assertFalse(rule.checkAddressCountryEmptyStateZip(address));
262:                }
263:            }
264:
265:            public void testCheckAddressCountryEmptyStateZip_WithUSWithBothStatesWithOneZipOneNull() {
266:                List<VendorAddress> addrList = VendorRuleAddressStateZipFixture.BOTH_US_BOTH_STATES_ONE_ZIP_ONE_NULL
267:                        .populateAddresses();
268:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
269:                        VendorRule.class);
270:                rule.refreshSubObjects(newVendor);
271:                for (int i = 0; i < addrList.size(); i++) {
272:                    VendorAddress address = addrList.get(i);
273:                    if (i == 0) {
274:                        assertTrue(rule
275:                                .checkAddressCountryEmptyStateZip(address));
276:                    } else if (i == 1) {
277:                        assertFalse(rule
278:                                .checkAddressCountryEmptyStateZip(address));
279:                    }
280:                }
281:            }
282:
283:            public void testCheckAddressCountryEmptyStateZip_WithUSWithBothStatesWithOneZipOneEmpty() {
284:                List<VendorAddress> addrList = VendorRuleAddressStateZipFixture.BOTH_US_BOTH_STATES_ONE_ZIP_ONE_EMPTY
285:                        .populateAddresses();
286:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
287:                        VendorRule.class);
288:                rule.refreshSubObjects(newVendor);
289:                for (int i = 0; i < addrList.size(); i++) {
290:                    VendorAddress address = addrList.get(i);
291:                    if (i == 0) {
292:                        assertTrue(rule
293:                                .checkAddressCountryEmptyStateZip(address));
294:                    } else if (i == 1) {
295:                        assertFalse(rule
296:                                .checkAddressCountryEmptyStateZip(address));
297:                    }
298:                }
299:            }
300:
301:            public void testCheckAddressCountryEmptyStateZip_WithoutUSBothStatesWithoutZips() {
302:                List<VendorAddress> addrList = VendorRuleAddressStateZipFixture.WITHOUT_US_BOTH_STATES_WITHOUT_ZIPS
303:                        .populateAddresses();
304:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
305:                        VendorRule.class);
306:                rule.refreshSubObjects(newVendor);
307:                int i = 0;
308:                for (VendorAddress address : addrList) {
309:                    i++;
310:                    assertTrue(rule.checkAddressCountryEmptyStateZip(address));
311:                }
312:            }
313:
314:            public void testCheckAddressCountryEmptyStateZip_WithoutUSBothStatesWithEmptyZips() {
315:                List<VendorAddress> addrList = VendorRuleAddressStateZipFixture.WITHOUT_US_BOTH_STATES_EMPTY_ZIPS
316:                        .populateAddresses();
317:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
318:                        VendorRule.class);
319:                rule.refreshSubObjects(newVendor);
320:                int i = 0;
321:                for (VendorAddress address : addrList) {
322:                    i++;
323:                    assertTrue(rule.checkAddressCountryEmptyStateZip(address));
324:                }
325:            }
326:
327:            public void testCheckAddressCountryEmptyStateZip_WithoutUSBothStatesWithBothZips() {
328:                List<VendorAddress> addrList = VendorRuleAddressStateZipFixture.WITHOUT_US_BOTH_STATES_BOTH_ZIPS
329:                        .populateAddresses();
330:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
331:                        VendorRule.class);
332:                rule.refreshSubObjects(newVendor);
333:                int i = 0;
334:                for (VendorAddress address : addrList) {
335:                    i++;
336:                    assertTrue(rule.checkAddressCountryEmptyStateZip(address));
337:                }
338:            }
339:
340:            /*
341:             * TESTS OF CheckFaxNumber
342:             */
343:            public void testCheckFaxNumber_WithDefaultFormats() {
344:                VendorRuleFaxNumberFixture vrfnf = VendorRuleFaxNumberFixture.TWO_DEFAULT_FORMATS;
345:                List<VendorAddress> addrList = vrfnf.getAddresses();
346:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
347:                        VendorRule.class);
348:                rule.refreshSubObjects(newVendor);
349:                int i = 0;
350:                for (VendorAddress address : addrList) {
351:                    i++;
352:                    assertTrue(rule.checkFaxNumber(address));
353:                }
354:            }
355:
356:            public void testCheckFaxNumber_WithShortNumber() {
357:                VendorRuleFaxNumberFixture vrfnf = VendorRuleFaxNumberFixture.TWO_SHORT_FAXES;
358:                List<VendorAddress> addrList = vrfnf.getAddresses();
359:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
360:                        VendorRule.class);
361:                rule.refreshSubObjects(newVendor);
362:                int i = 0;
363:                for (VendorAddress address : addrList) {
364:                    i++;
365:                    assertFalse(rule.checkFaxNumber(address));
366:                }
367:            }
368:
369:            public void testCheckFaxNumber_WithOneDefaultOneShortFax() {
370:                VendorRuleFaxNumberFixture vrfnf = VendorRuleFaxNumberFixture.ONE_DEFAULT_ONE_SHORT_FAX;
371:                List<VendorAddress> addrList = vrfnf.getAddresses();
372:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
373:                        VendorRule.class);
374:                rule.refreshSubObjects(newVendor);
375:                for (int i = 0; i < addrList.size(); i++) {
376:                    VendorAddress address = addrList.get(i);
377:                    if (i == 0) {
378:                        assertTrue(rule.checkFaxNumber(address));
379:                    } else if (i == 1) {
380:                        assertFalse(rule.checkFaxNumber(address));
381:                    }
382:                }
383:            }
384:
385:            /**
386:             * This method does the setup for the tests which examine the implementation of the requirement that vendor contracts be
387:             * validated so that their begin date comes before their end date. Uses two contracts.
388:             * 
389:             * @param vcbedf
390:             * @return
391:             */
392:            protected VendorRule validateVendorContractBeginEndDates_TestHelper(
393:                    VendorContractBeginEndDatesFixture vcbedf) {
394:                newVendor.setVendorContracts(vcbedf.populateContracts());
395:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
396:                        VendorRule.class);
397:                rule.refreshSubObjects(newVendor);
398:                return rule;
399:            }
400:
401:            public void testValidateVendorContractBeginEndDates_RightOrderRightOrder() {
402:                VendorRule rule = validateVendorContractBeginEndDates_TestHelper(VendorContractBeginEndDatesFixture.RIGHT_ORDER_RIGHT_ORDER);
403:
404:                List<VendorContract> contractList = newVendor
405:                        .getVendorContracts();
406:                for (VendorContract contract : contractList) {
407:                    assertTrue(rule
408:                            .validateVendorContractBeginEndDates(contract));
409:                }
410:            }
411:
412:            public void testValidateVendorContractBeginEndDates_WrongOrder() {
413:                VendorRule rule = validateVendorContractBeginEndDates_TestHelper(VendorContractBeginEndDatesFixture.WRONG_ORDER_RIGHT_ORDER);
414:
415:                List<VendorContract> contractList = newVendor
416:                        .getVendorContracts();
417:                // ripierce: the fixture sets up two contracts but we only want to test the 1st (bad) one.
418:                // If we test the second (good) one last, the test fails.
419:                VendorContract contract = contractList.get(0);
420:                assertFalse(rule.validateVendorContractBeginEndDates(contract));
421:            }
422:
423:            public void testValidateVendorContractBeginEndDates_RightOrderWrongOrder() {
424:                VendorRule rule = validateVendorContractBeginEndDates_TestHelper(VendorContractBeginEndDatesFixture.RIGHT_ORDER_WRONG_ORDER);
425:
426:                List<VendorContract> contractList = newVendor
427:                        .getVendorContracts();
428:                // ripierce: the fixture sets up two contracts but we only want to test the 2nd bad one.
429:                VendorContract contract = contractList.get(1);
430:                assertFalse(rule.validateVendorContractBeginEndDates(contract));
431:            }
432:
433:            /**
434:             * This method...
435:             * 
436:             * @param vcpolapf
437:             * @return
438:             */
439:            private VendorRule validateVendorContractPOLimitAmountPresence_testHelper(
440:                    VendorContractPurchaseOrderLimitAmountPresenceFixture vcpolapf) {
441:                List contracts = vcpolapf.populateContracts();
442:                newVendor.setVendorContracts(contracts);
443:                VendorRule rule = (VendorRule) setupMaintDocRule(newVendor,
444:                        VendorRule.class);
445:                rule.refreshSubObjects(newVendor);
446:                return rule;
447:            }
448:
449:            public void testValidateVendorContractPurchaseOrderLimitAmountPresence_NoExcludes() {
450:                VendorRule rule = validateVendorContractPOLimitAmountPresence_testHelper(VendorContractPurchaseOrderLimitAmountPresenceFixture.NO_EXCLUDES);
451:
452:                List<VendorContract> contractList = newVendor
453:                        .getVendorContracts();
454:                for (VendorContract contract : contractList) {
455:                    assertTrue(rule
456:                            .validateVendorContractPOLimitAndExcludeFlagCombination(contract));
457:                }
458:
459:            }
460:
461:            public void testValidateVendorContractPurchaseOrderLimitAmountPresence_TwoNExcludesOnFirstTwoLimits() {
462:                VendorRule rule = validateVendorContractPOLimitAmountPresence_testHelper(VendorContractPurchaseOrderLimitAmountPresenceFixture.TWO_N_EXCLUDES_ON_FIRST_TWO_LIMITS);
463:
464:                List<VendorContract> contractList = newVendor
465:                        .getVendorContracts();
466:                for (VendorContract contract : contractList) {
467:                    assertTrue(rule
468:                            .validateVendorContractPOLimitAndExcludeFlagCombination(contract));
469:                }
470:            }
471:
472:            public void testValidateVendorContractPurchaseOrderLimitAmountPresence_TwoNExcludesOnFirstLimitOnFirst() {
473:                VendorRule rule = validateVendorContractPOLimitAmountPresence_testHelper(VendorContractPurchaseOrderLimitAmountPresenceFixture.TWO_N_EXCLUDES_ON_FIRST_LIMIT_ON_FIRST);
474:
475:                List<VendorContract> contractList = newVendor
476:                        .getVendorContracts();
477:                // ripierce: the fixture sets up two contracts but we only want to test the 2nd bad one.
478:                VendorContract contract = contractList.get(1);
479:                assertFalse(rule
480:                        .validateVendorContractPOLimitAndExcludeFlagCombination(contract));
481:            }
482:
483:            public void testValidateVendorContractPurchaseOrderLimitAmountPresence_OneYExcludeOnFirstNoLimitOnFirst() {
484:                VendorRule rule = validateVendorContractPOLimitAmountPresence_testHelper(VendorContractPurchaseOrderLimitAmountPresenceFixture.ONE_Y_EXCLUDE_ON_FIRST_NO_LIMIT_ON_FIRST);
485:
486:                List<VendorContract> contractList = newVendor
487:                        .getVendorContracts();
488:                for (VendorContract contract : contractList) {
489:                    assertFalse(rule
490:                            .validateVendorContractPOLimitAndExcludeFlagCombination(contract));
491:                }
492:            }
493:
494:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.