01: /*
02: * Copyright 2005-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.chart.service;
17:
18: import org.kuali.kfs.context.KualiTestBase;
19: import org.kuali.kfs.context.SpringContext;
20: import org.kuali.module.chart.bo.SubObjCd;
21: import org.kuali.test.ConfigureContext;
22:
23: /**
24: * This class tests the SubObjectCode service.
25: */
26: @ConfigureContext
27: public class SubObjectCodeServiceTest extends KualiTestBase {
28:
29: /**
30: * Test that the service returns null if any of the parameters are empty.
31: */
32: public void testEmptyParam() {
33: SubObjCd resultSubObjectCode = SpringContext.getBean(
34: SubObjectCodeService.class).getByPrimaryId(
35: new Integer(0), TestConstants.Data4.CHART_CODE,
36: TestConstants.Data4.ACCOUNT,
37: TestConstants.Data4.OBJECT_CODE,
38: TestConstants.Data4.SUBOBJECT_CODE);
39: assertNull(resultSubObjectCode);
40:
41: resultSubObjectCode = SpringContext.getBean(
42: SubObjectCodeService.class).getByPrimaryId(
43: TestConstants.Data4.POSTING_YEAR, "",
44: TestConstants.Data4.ACCOUNT,
45: TestConstants.Data4.OBJECT_CODE,
46: TestConstants.Data4.SUBOBJECT_CODE);
47: assertNull(resultSubObjectCode);
48:
49: resultSubObjectCode = SpringContext.getBean(
50: SubObjectCodeService.class).getByPrimaryId(
51: TestConstants.Data4.POSTING_YEAR,
52: TestConstants.Data4.CHART_CODE, "",
53: TestConstants.Data4.OBJECT_CODE,
54: TestConstants.Data4.SUBOBJECT_CODE);
55: assertNull(resultSubObjectCode);
56:
57: resultSubObjectCode = SpringContext.getBean(
58: SubObjectCodeService.class).getByPrimaryId(
59: TestConstants.Data4.POSTING_YEAR,
60: TestConstants.Data4.CHART_CODE,
61: TestConstants.Data4.ACCOUNT, "",
62: TestConstants.Data4.SUBOBJECT_CODE);
63: assertNull(resultSubObjectCode);
64:
65: resultSubObjectCode = SpringContext.getBean(
66: SubObjectCodeService.class).getByPrimaryId(
67: TestConstants.Data4.POSTING_YEAR,
68: TestConstants.Data4.CHART_CODE,
69: TestConstants.Data4.ACCOUNT,
70: TestConstants.Data4.OBJECT_CODE, "");
71: assertNull(resultSubObjectCode);
72: }
73:
74: /**
75: * Test that the service returns the correct results based on the given pararmeters.
76: */
77: public void testService() {
78: SubObjCd resultSubObjectCode = null;
79:
80: resultSubObjectCode = SpringContext.getBean(
81: SubObjectCodeService.class).getByPrimaryId(
82: TestConstants.Data4.POSTING_YEAR,
83: TestConstants.Data4.CHART_CODE,
84: TestConstants.Data4.ACCOUNT,
85: TestConstants.Data4.OBJECT_CODE,
86: TestConstants.Data4.SUBOBJECT_CODE);
87: assertNotNull(resultSubObjectCode);
88: assertTrue(resultSubObjectCode
89: .isFinancialSubObjectActiveIndicator());
90:
91: }
92: }
|