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.SubFundGroup;
21: import org.kuali.test.ConfigureContext;
22:
23: /**
24: * This class tests the subFundGroup service.
25: */
26: @ConfigureContext
27: public class SubFundGroupServiceTest extends KualiTestBase {
28:
29: public final void testGetByCode_knownCode() {
30: // known-good code
31: SubFundGroup subFundGroup = SpringContext.getBean(
32: SubFundGroupService.class).getByPrimaryId("LOANFD");
33: assertEquals("Known code does not produce expected name.",
34: "LOAN FUNDS", subFundGroup.getSubFundGroupDescription());
35: }
36:
37: public final void testGetByCode_knownCode2() {
38: // known-good code
39: SubFundGroup subFundGroup = SpringContext.getBean(
40: SubFundGroupService.class).getByPrimaryId("CLEAR");
41: assertEquals("Known code does not produce expected name.",
42: "CLEARING AND ROTATING FUNDS", subFundGroup
43: .getSubFundGroupDescription());
44: }
45:
46: public final void testGetByCode_unknownCode() {
47: // known-bad code
48: SubFundGroup subFundGroup = SpringContext.getBean(
49: SubFundGroupService.class).getByPrimaryId("SMELL");
50: assertNull(
51: "Known-bad code does not produce expected null object.",
52: subFundGroup);
53: }
54:
55: public final void testGetByChartAndAccount() {
56: String chartCode = "BL";
57: String accountNumber = "1031420";
58: SubFundGroup subFundGroup = SpringContext.getBean(
59: SubFundGroupService.class).getByChartAndAccount(
60: chartCode, accountNumber);
61: assertNotNull(subFundGroup);
62: assertEquals("Foo", "GENFND", subFundGroup
63: .getSubFundGroupCode());
64: }
65:
66: public final void testGetByName_knownName() {
67: // TODO: commented out, because there is no equivalent to getByName on regular business objects
68: // known-good name
69: // subFundGroup = null;
70: // subFundGroup = (subFundGroup) kualiCodeService.getByName(subFundGroup.class, "LOAN FUNDS");
71: // assertEquals("Known code does not produce expected name.", "LOANFD", subFundGroup.getCode());
72: }
73:
74: public final void testGetByName_knownName2() {
75: // TODO: commented out, because there is no equivalent to getByName on regular business objects
76: // known-good name
77: // subFundGroup = null;
78: // subFundGroup = (subFundGroup) kualiCodeService.getByName(subFundGroup.class, "CLEARING AND ROTATING FUNDS");
79: // assertEquals("Known code does not produce expected name.", "CLEAR", subFundGroup.getCode());
80: // assertEquals("Known code's active indicator conversion failed.", true, subFundGroup.isActive());
81: // assertEquals("Known code's wage indicator conversion failed.", false, subFundGroup.isWageIndicator());
82: }
83:
84: public final void testGetByName_unknownName() {
85: // TODO: commented out, because there is no equivalent to getByName on regular business objects
86: // known-bad name
87: // subFundGroup = null;
88: // subFundGroup = (subFundGroup) kualiCodeService.getByName(subFundGroup.class, "Smelly Cat");
89: // assertNull("Known-bad name does not produce expected null object.", subFundGroup);
90: }
91: }
|