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.kfs.service.KualiCodeService;
21: import org.kuali.module.chart.bo.FundGroup;
22: import org.kuali.test.ConfigureContext;
23:
24: /**
25: * This class tests the FundGroup service.
26: */
27:
28: @ConfigureContext
29: public class FundGroupServiceTest extends KualiTestBase {
30:
31: public void testGetByCode_knownCode1() {
32: FundGroup fundGroup = (FundGroup) SpringContext.getBean(
33: KualiCodeService.class)
34: .getByCode(FundGroup.class, "LF");
35: assertEquals("Known code does not produce expected name.",
36: "LOAN FUNDS", fundGroup.getName());
37: }
38:
39: public void testGetByCode_knownName1() {
40: FundGroup fundGroup = (FundGroup) SpringContext.getBean(
41: KualiCodeService.class).getByName(FundGroup.class,
42: "LOAN FUNDS");
43: assertEquals("Known code does not produce expected name.",
44: "LF", fundGroup.getCode());
45: }
46:
47: public void testGetByCode_knownCode2() {
48: FundGroup fundGroup = (FundGroup) SpringContext.getBean(
49: KualiCodeService.class)
50: .getByCode(FundGroup.class, "AF");
51: assertEquals("Known code does not produce expected name.",
52: "AGENCY FUNDS", fundGroup.getName());
53: }
54:
55: public void testGetByCode_knownName2() {
56: FundGroup fundGroup = (FundGroup) SpringContext.getBean(
57: KualiCodeService.class).getByName(FundGroup.class,
58: "AGENCY FUNDS");
59: assertEquals("Known code does not produce expected name.",
60: "AF", fundGroup.getCode());
61: }
62:
63: public void testGetByCode_unknownCode() {
64: FundGroup fundGroup = (FundGroup) SpringContext.getBean(
65: KualiCodeService.class)
66: .getByCode(FundGroup.class, "XX");
67: assertNull(
68: "Known-bad code does not produce expected null object.",
69: fundGroup);
70: }
71:
72: public void testGetByName_unknownName() {
73: FundGroup fundGroup = (FundGroup) SpringContext.getBean(
74: KualiCodeService.class).getByName(FundGroup.class,
75: "The Cat In the Hat");
76: assertNull(
77: "Known-bad name does not produce expected null object.",
78: fundGroup);
79: }
80: }
|