01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.module.purap.rules;
17:
18: import static org.kuali.test.fixtures.UserNameFixture.KHUNTLEY;
19:
20: import org.kuali.module.purap.document.PurchasingDocument;
21: import org.kuali.module.purap.fixtures.RecurringPaymentBeginEndDatesFixture;
22: import org.kuali.test.ConfigureContext;
23:
24: /**
25: * This class contains tests of the rule validation methods present in PurchasingDocumentRuleBase. These should include any tests
26: * that test functionality that is common to all Purchasing documents.
27: */
28: @ConfigureContext(session=KHUNTLEY)
29: public class PurchasingDocumentRuleTest extends PurapRuleTestBase {
30:
31: PurchasingDocumentRuleBase rules;
32:
33: protected void setUp() throws Exception {
34: super .setUp();
35: rules = new PurchasingDocumentRuleBase();
36: }
37:
38: protected void tearDown() throws Exception {
39: rules = null;
40: super .tearDown();
41: }
42:
43: /**
44: * These methods test how the method validating the input to the Payment Info tab on Purchasing documents,
45: * PurchasingDocumentRuleBase.processPaymentInfoValidation, works for Requisitions and POs with different combinations of
46: * beginning and ending dates, fiscal years, and recurring payment types.
47: */
48: public void testProcessPaymentInfoValidation_Req_RightOrder() {
49: PurchasingDocument document = RecurringPaymentBeginEndDatesFixture.REQ_RIGHT_ORDER
50: .populateDocument();
51: assertTrue(rules.processPaymentInfoValidation(document));
52: }
53:
54: public void testProcessPaymentInfoValidation_Req_WrongOrder() {
55: PurchasingDocument document = RecurringPaymentBeginEndDatesFixture.REQ_WRONG_ORDER
56: .populateDocument();
57: assertFalse(rules.processPaymentInfoValidation(document));
58: }
59:
60: public void testProcessPaymentInfoValidation_Req_Sequential_Next_FY() {
61: PurchasingDocument document = RecurringPaymentBeginEndDatesFixture.REQ_SEQUENTIAL_NEXT_FY
62: .populateDocument();
63: assertTrue(rules.processPaymentInfoValidation(document));
64: }
65:
66: public void testProcessPaymentInfoValidation_Req_Non_Sequential_Next_FY() {
67: PurchasingDocument document = RecurringPaymentBeginEndDatesFixture.REQ_NON_SEQUENTIAL_NEXT_FY
68: .populateDocument();
69: assertFalse(rules.processPaymentInfoValidation(document));
70: }
71:
72: public void testProcessPaymentInfoValidation_PO_RightOrder() {
73: PurchasingDocument document = RecurringPaymentBeginEndDatesFixture.PO_RIGHT_ORDER
74: .populateDocument();
75: assertTrue(rules.processPaymentInfoValidation(document));
76: }
77:
78: public void testProcessPaymentInfoValidation_PO_WrongOrder() {
79: PurchasingDocument document = RecurringPaymentBeginEndDatesFixture.PO_WRONG_ORDER
80: .populateDocument();
81: assertFalse(rules.processPaymentInfoValidation(document));
82: }
83:
84: public void testProcessPaymentInfoValidation_PO_Sequential_Next_FY() {
85: PurchasingDocument document = RecurringPaymentBeginEndDatesFixture.PO_SEQUENTIAL_NEXT_FY
86: .populateDocument();
87: assertTrue(rules.processPaymentInfoValidation(document));
88: }
89:
90: public void testProcessPaymentInfoValidation_PO_Non_Sequential_Next_FY() {
91: PurchasingDocument document = RecurringPaymentBeginEndDatesFixture.PO_NON_SEQUENTIAL_NEXT_FY
92: .populateDocument();
93: assertFalse(rules.processPaymentInfoValidation(document));
94: }
95: }
|