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.labor.service;
17:
18: import java.util.Collection;
19: import java.util.Iterator;
20:
21: import org.kuali.kfs.context.KualiTestBase;
22: import org.kuali.kfs.context.SpringContext;
23: import org.kuali.module.labor.bo.PositionObjectBenefit;
24: import org.kuali.test.ConfigureContext;
25: import org.kuali.test.KualiTestConstants.TestConstants.PositionObjectTestData;
26:
27: /**
28: * JUnit test for LaborPositionObjectBenefitService
29: */
30: @ConfigureContext
31: public class LaborPositionObjectBenefitServiceTest extends
32: KualiTestBase {
33:
34: private LaborPositionObjectBenefitService laborPositionObjectBenefitService;
35:
36: /**
37: * @see junit.framework.TestCase#setUp()
38: */
39: @Override
40: protected void setUp() throws Exception {
41: super .setUp();
42: laborPositionObjectBenefitService = SpringContext
43: .getBean(LaborPositionObjectBenefitService.class);
44: }
45:
46: /**
47: * Test testGetPositionObjectBenefits_valid() for valid position object benefits
48: *
49: * @throws Exception
50: */
51: public void testGetPositionObjectBenefits_valid() throws Exception {
52: Collection<PositionObjectBenefit> results = laborPositionObjectBenefitService
53: .getPositionObjectBenefits(
54: Integer
55: .valueOf(PositionObjectTestData.UNIVERSITY_FISCAL_YEAR),
56: PositionObjectTestData.CHART_OF_ACCOUNTS_CODE,
57: PositionObjectTestData.FINANCIAL_OBJECT_CODE);
58: super
59: .assertNotNull(
60: "Expected position object parameters to return not null.",
61: results);
62:
63: for (Iterator iter = results.iterator(); iter.hasNext();) {
64: PositionObjectBenefit element = (PositionObjectBenefit) iter
65: .next();
66: super.assertEquals(element.getUniversityFiscalYear()
67: .intValue(), Integer.valueOf(
68: PositionObjectTestData.UNIVERSITY_FISCAL_YEAR)
69: .intValue());
70: super.assertEquals(element.getChartOfAccountsCode(),
71: PositionObjectTestData.CHART_OF_ACCOUNTS_CODE);
72: super.assertEquals(element.getFinancialObjectCode(),
73: PositionObjectTestData.FINANCIAL_OBJECT_CODE);
74: }
75: }
76: }
|