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.financial.service;
17:
18: import java.util.ArrayList;
19:
20: import org.kuali.kfs.context.KualiTestBase;
21: import org.kuali.kfs.context.SpringContext;
22: import org.kuali.module.financial.bo.CashDetailTypeCode;
23: import org.kuali.module.financial.service.impl.CashDetailTypeCodeServiceImpl;
24: import org.kuali.test.ConfigureContext;
25:
26: /**
27: * This class tests the CashDetailTypeCode service.
28: */
29: @ConfigureContext
30: public class CashDetailTypeCodeServiceTest extends KualiTestBase {
31: private ArrayList validCashDetailTypeCodes;
32:
33: /**
34: * This method performs all the setup steps necessary to run the tests within this test case.
35: *
36: * @see junit.framework.TestCase#setUp()
37: */
38: @Override
39: protected void setUp() throws Exception {
40: super .setUp();
41: // this.validCashDetailTypeCodes = (ArrayList)
42: // SpringContext.getBean(BusinessObjectService.class).findAll(CashDetailTypeCode.class);
43: // TODO - uncomment the above line of code when the database table for cash detail type codes is put in place and populated;
44: // remove the line below
45: populateValidCashDetailTypeCodes();
46: }
47:
48: /**
49: *
50: * This method tests that the getter for a CashDetailTypeCode works properly and is capable of retrieving a
51: * valid CashDetailTypeCode object.
52: */
53: public void testGetCashReceiptTypeCode() {
54: assertEquals(true, validCashDetailTypeCodes
55: .contains(SpringContext.getBean(
56: CashDetailTypeCodeService.class)
57: .getCashReceiptCheckTypeCode()));
58: }
59:
60: /**
61: *
62: * This method creates a dummy CashDetailTypeCode object instance using the value given as the code to assign to the dummy.
63: * @param cashDetailTypeCodeCode The code to be assigned to the dummy instance.
64: * @return A dummy instance of a CashDetailTypeCode object with the code set to the value provided.
65: */
66: private CashDetailTypeCode getDummyInstance(
67: String cashDetailTypeCodeCode) {
68: CashDetailTypeCode cashDetailTypeCode = new CashDetailTypeCode();
69: cashDetailTypeCode.setCode(cashDetailTypeCodeCode);
70: return cashDetailTypeCode;
71: }
72:
73: /**
74: * TODO Remove this once the database table is in place.
75: */
76: private void populateValidCashDetailTypeCodes() {
77: this .validCashDetailTypeCodes = new ArrayList();
78: this.validCashDetailTypeCodes
79: .add(getDummyInstance(CashDetailTypeCodeServiceImpl.CASH_RECEIPT_CHECK));
80: }
81: }
|