View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package org.kuali.kfs.module.ar.document.validation.impl;
20  
21  import org.kuali.kfs.module.ar.businessobject.NonInvoiced;
22  import org.kuali.kfs.sys.ConfigureContext;
23  import org.kuali.kfs.sys.context.KualiTestBase;
24  import org.kuali.rice.core.api.util.type.KualiDecimal;
25  
26  @ConfigureContext
27  public class PaymentApplicationDocumentRuleUtilsTest extends KualiTestBase {
28  
29      private static final String NON_AR_CHART_CD = "BL";
30      private static final String NON_AR_ACCOUNT_NBR = "1031420";
31      private static final String NON_AR_OBJ_CD = "1500";
32      private static final String NON_AR_ACCOUNT_NBR_BAD = "999999999999999999";
33      
34      public void testNonArLineOverFundsInvoice() {
35          
36          //  build the nonArLine
37          NonInvoiced nonArLine = new NonInvoiced();
38          nonArLine.setChartOfAccountsCode(NON_AR_CHART_CD);
39          nonArLine.setAccountNumber(NON_AR_ACCOUNT_NBR);
40          nonArLine.setFinancialObjectCode(NON_AR_OBJ_CD);
41          nonArLine.setFinancialDocumentLineAmount(new KualiDecimal("500.00"));
42          
43          boolean result = true;
44          
45          // These cases are tested in PaymentApplicationDocumentTest
46          
47  //        //  test correctly funding from non-AR (to make sure it doesnt false-positive fail)
48  //        result = PaymentApplicationDocumentRuleUtil.validateNonInvoiced(nonArLine, new KualiDecimal("750.00"));
49  //        assertTrue("Rule should pass.", result);
50  //        
51  //        //  test overfunding from non-AR
52  //        result = PaymentApplicationDocumentRuleUtil.validateNonInvoiced(nonArLine, new KualiDecimal("250.00"));
53  //        assertFalse("Rule should fail, since nonArLine is overfunded.", result);
54  //        
55  //        //  test not allowing zero
56  //        nonArLine.setFinancialDocumentLineAmount(new KualiDecimal("0.00"));
57  //        result = PaymentApplicationDocumentRuleUtil.validateNonInvoiced(nonArLine, new KualiDecimal("500.00"));
58  //        assertFalse("Rules should fail, since nonArLine total is zero.", result);
59  //        
60  //        //  test failing validateBO test
61  //        nonArLine.setAccountNumber(NON_AR_ACCOUNT_NBR_BAD);
62  //        nonArLine.setFinancialDocumentLineAmount(new KualiDecimal("500.00"));
63  //        result = PaymentApplicationDocumentRuleUtil.validateNonInvoiced(nonArLine, new KualiDecimal("500.00"));
64  //        assertFalse("Rule should fail as nonsense account number is used.", result);
65          
66      }
67      
68  }