1 /**
2 * Copyright 2004-2013 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
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.hr.lm.balancetransfer.validation;
17
18 import static org.junit.Assert.*;
19
20 import java.util.HashMap;
21
22 import org.junit.After;
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.kuali.hr.lm.balancetransfer.BalanceTransfer;
26 import org.kuali.hr.test.KPMETestCase;
27 import org.kuali.hr.time.clock.location.ClockLocationRule;
28 import org.kuali.hr.time.util.TKContext;
29 import org.kuali.rice.krad.service.BusinessObjectService;
30 import org.kuali.rice.krad.service.KRADServiceLocator;
31
32 public class BalanceTransferValidationTest extends KPMETestCase {
33
34 private BusinessObjectService boService;
35
36 @Before
37 public void setUp() throws Exception {
38 super.setUp();
39 boService = KRADServiceLocator.getBusinessObjectService();
40 clearBusinessObjects(BalanceTransfer.class);
41 }
42
43 @After
44 public void tearDown() throws Exception {
45 super.tearDown();
46 }
47
48 @Test
49 public void testOverMaxCarryOver() throws Exception{
50 assertTrue("Dummy assertion", true);
51 }
52
53 /*
54 @Test
55 public void testAtMaxCarryOver() throws Exception{
56 assertTrue(true);
57 }
58
59 @Test
60 public void testUnderMaxBalanceBalanceTransfer() throws Exception{
61 //ensure that balance transfer isn't triggered by accrual categories whose balance is
62 //less than the max balance.
63 //Exception could be balance transfers for termination/retirement where max balance
64 //is not yet reached.
65 assertTrue(true);
66 }
67
68 @Test
69 public void testOverMaxBalanceBalanceTransfer() throws Exception{
70 assertTrue(true);
71 }
72
73 @Test
74 public void testAtMaxBalanceBalanceTransfer() throws Exception{
75 assertTrue(true);
76 }
77
78 @Test
79 public void testBalanceTransferOfPartialFTE() throws Exception{
80 //TODO: Balance transfer test of employee having more than one leave eligible job
81 // but whose FTE is less than one.
82 assertTrue(true);
83 }
84
85 @Test
86 public void testBalanceTransferOfPartialFTECase2() throws Exception{
87 //TODO: Balance transfer test of employee having more than one leave eligible job
88 // and whose FTE is 1
89 assertTrue(true);
90 }
91
92 @Test
93 public void testBalanceTransferOfNonFTEEmployee() throws Exception{
94 //TODO: Balance transfer should not be available for employee having no leave
95 // eligible job (FTE=0)
96 assertTrue(true);
97 }
98 */
99
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 }