001    /**
002     * Copyright 2004-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.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/ecl2.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.hr.lm.balancetransfer.validation;
017    
018    import static org.junit.Assert.*;
019    
020    import java.util.HashMap;
021    
022    import org.junit.After;
023    import org.junit.Before;
024    import org.junit.Test;
025    import org.kuali.hr.lm.balancetransfer.BalanceTransfer;
026    import org.kuali.hr.test.KPMETestCase;
027    import org.kuali.hr.time.clock.location.ClockLocationRule;
028    import org.kuali.hr.time.util.TKContext;
029    import org.kuali.rice.krad.service.BusinessObjectService;
030    import org.kuali.rice.krad.service.KRADServiceLocator;
031    
032    public class BalanceTransferValidationTest extends KPMETestCase {
033    
034            private BusinessObjectService boService;
035            
036            @Before
037            public void setUp() throws Exception {
038                    super.setUp();
039            boService = KRADServiceLocator.getBusinessObjectService();
040            clearBusinessObjects(BalanceTransfer.class);
041            }
042            
043            @After
044            public void tearDown() throws Exception {
045                    super.tearDown();
046            }
047            
048            @Test
049            public void testOverMaxCarryOver() throws Exception{
050                    assertTrue("Dummy assertion", true);
051            }
052            
053            /*
054            @Test
055            public void testAtMaxCarryOver() throws Exception{
056                    assertTrue(true);
057            }
058            
059            @Test
060            public void testUnderMaxBalanceBalanceTransfer() throws Exception{
061                    //ensure that balance transfer isn't triggered by accrual categories whose balance is
062                    //less than the max balance.
063                    //Exception could be balance transfers for termination/retirement where max balance
064                    //is not yet reached.
065                    assertTrue(true);
066            }
067            
068            @Test
069            public void testOverMaxBalanceBalanceTransfer() throws Exception{
070                    assertTrue(true);
071            }
072            
073            @Test
074            public void testAtMaxBalanceBalanceTransfer() throws Exception{
075                    assertTrue(true);
076            }
077            
078            @Test
079            public void testBalanceTransferOfPartialFTE() throws Exception{
080                    //TODO: Balance transfer test of employee having more than one leave eligible job
081                    // but whose FTE is less than one.
082                    assertTrue(true);
083            }
084            
085            @Test
086            public void testBalanceTransferOfPartialFTECase2() throws Exception{
087                    //TODO: Balance transfer test of employee having more than one leave eligible job
088                    // and whose FTE is 1
089                    assertTrue(true);
090            }
091            
092            @Test
093            public void testBalanceTransferOfNonFTEEmployee() throws Exception{
094                    //TODO: Balance transfer should not be available for employee having no leave
095                    // eligible job (FTE=0)
096                    assertTrue(true);
097            }
098            */
099            
100    //      /**
101    //       * Following tests should be moved to leave calendar to test on-demand balance transfers and payouts.
102    //       */
103    //      @Test
104    //      public void testOnDemandBalanceTransfer() throws Exception{
105    //              //TODO: Check to make sure that the "Transfer" button appears when max balance
106    //              // is reached for a transfer with action frequency "On-Demand" and action "Transfer"
107    //              // is in effect for accrual category.
108    //              assertTrue(true);
109    //      }
110    //      
111    //      @Test
112    //      public void testOnDemandBalancePayout() throws Exception{
113    //              //TODO: Check to make sure that the "Payout" button appears when max balance
114    //              // is reached for a transfer with action frequency "On-Demand" and action "payout"
115    //              // is in effect for accrual category.
116    //              assertTrue(true);
117    //      }
118    //      
119    //      @Test
120    //      public void testOnDemandBalanceTransferForMultipleAccrualCategories() throws Exception{
121    //              //TODO: Test that the "Transfer" button correctly displays when more than one accrual
122    //              // category reach max balance simultaneously.
123    //              assertTrue(true);
124    //      }
125    //      
126    //      @Test
127    //      public void testOnDemandBalancePayoutForMultipleAccrualCategories() throws Exception{
128    //              //TODO: Test that the "Payout" button displays correctly when more than one accrual
129    //              // category reach max balance simultaneously.
130    //              assertTrue(true);
131    //      }
132    //      
133    //      /**
134    //       * The following tests require setting up scenarios that occur on the set
135    //       * of possible max balance action frequencies. The result of each test should
136    //       * be dependent upon a balance transfer document correctly being created for each
137    //       * scenario.
138    //       */
139    //      @Test
140    //      public void testLeaveApproveBalanceTransferService() throws Exception{
141    //              /**
142    //               * TODO: Create the scenario where a balance TRANSFER should occur
143    //               * on max balance action frequency of "leave approval".
144    //               * Upon submitting a leave calendar document for approval,
145    //               * the user should be prompted for approval of balance TRANSFER
146    //               * according to the accrual categories max balance rules.
147    //               * A successful test would check that, upon affirmative action by the
148    //               * user, a balance transfer document should be created, and the
149    //               * balances of the respective accrual categories should reflect
150    //               * values in-line with the transfer AND accrual category rules.
151    //               * (i.e. the max balance conversion factor ).
152    //               */
153    //              assertTrue(true);
154    //      }
155    //      
156    //      @Test
157    //      public void testLeaveApprovalBalancePayoutService() throws Exception{
158    //              /**
159    //               * TODO: Create the scenario where a balance PAYOUT should occur
160    //               * on max balance action frequency of "leave approval".
161    //               * Upon submitting a leave calendar document for approval,
162    //               * the user should be prompted for approval of balance PAYOUT
163    //               * according to the accrual categories max balance rules.
164    //               * A successful test would check that, upon affirmative action by the
165    //               * user, a balance transfer document is created, and the
166    //               * balances of the respective accrual categories should reflect
167    //               * values in-line with the transfer AND accrual category rules.
168    //               * (i.e. the max balance conversion factor ).
169    //               */     
170    //              assertTrue(true);
171    //      }
172    //      
173    //      @Test
174    //      public void testYearEndBalanceTransferService() throws Exception{
175    //              /**
176    //               * TODO: Create the scenario where a balance transfer should occur
177    //               * on max balance action frequency of "YEAR END".
178    //               * Upon submitting the final leave calendar document for approval,
179    //               * the user should be prompted for approval of balance transfer
180    //               * according to the accrual categories max balance rules.
181    //               * A successful test would check that, upon affirmative action by the
182    //               * user, a balance transfer document should be created, and the
183    //               * balances of the respective accrual categories should reflect
184    //               * values in-line with the transfer AND accrual category rules.
185    //               * (i.e. the max balance conversion factor ).
186    //               */
187    //              assertTrue(true);
188    //      }
189    //      
190    //      @Test
191    //      public void testYearEndBalancePayoutService() throws Exception {
192    //              /**
193    //               * TODO: Create the scenario where a balance PAYOUT should occur
194    //               * on max balance action frequency of "YEAR END".
195    //               * Upon submitting a leave calendar document for approval,
196    //               * the user should be prompted for approval of balance PAYOUT
197    //               * according to the accrual categories max balance rules.
198    //               * A successful test would check that, upon affirmative action by the
199    //               * user, a balance transfer document should be created, and the
200    //               * balances of the respective accrual categories should reflect
201    //               * values in-line with the transfer AND accrual category rules.
202    //               * (i.e. the max balance conversion factor ).
203    //               * For successful payout, the test must check that a new, previously defined earn code
204    //               * should exist for the user, and that this earn code is available for use.
205    //               */
206    //              assertTrue(true);
207    //      }
208            
209        @SuppressWarnings("unchecked")
210        public void clearBusinessObjects(Class clazz) {
211            boService.deleteMatching(clazz, new HashMap());
212        }
213    }