001: /*
002: * Copyright 2006-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.module.financial.service;
017:
018: import static org.kuali.test.fixtures.AccountFixture.ACCOUNT_NON_PRESENCE_ACCOUNT;
019: import static org.kuali.test.fixtures.AccountFixture.ACCOUNT_PRESENCE_ACCOUNT;
020: import static org.kuali.test.fixtures.ObjectCodeFixture.OBJECT_CODE_BUDGETED_OBJECT_CODE;
021: import static org.kuali.test.fixtures.ObjectCodeFixture.OBJECT_CODE_NON_BUDGET_OBJECT_CODE;
022:
023: import org.kuali.core.service.BusinessObjectService;
024: import org.kuali.kfs.context.KualiTestBase;
025: import org.kuali.kfs.context.SpringContext;
026: import org.kuali.test.ConfigureContext;
027:
028: /**
029: * This class tests the AccountPresenceService.
030: */
031: @ConfigureContext
032: public class AccountPresenceServiceTest extends KualiTestBase {
033:
034: /**
035: * Tests non budgeted object code for account with presence control fails service method.
036: *
037: * @throws Exception
038: */
039: public void testAccountPresenceNonBudgetedObject() throws Exception {
040: assertFalse(
041: "Non budgeded object code passed ",
042: SpringContext
043: .getBean(AccountPresenceService.class)
044: .isObjectCodeBudgetedForAccountPresence(
045: ACCOUNT_PRESENCE_ACCOUNT
046: .createAccount(SpringContext
047: .getBean(BusinessObjectService.class)),
048: OBJECT_CODE_NON_BUDGET_OBJECT_CODE
049: .createObjectCode(SpringContext
050: .getBean(BusinessObjectService.class))));
051:
052: }
053:
054: /**
055: * Tests budgeted object code for account with presence control passes service method.
056: *
057: * @throws Exception
058: */
059: // public void testAccountPresenceBudgetedObject() throws Exception {
060: // assertTrue("Budgeted object code failed ",
061: // accountPresenceService.isObjectCodeBudgetedForAccountPresence(getAccountWithPresenceControl(),
062: // getBudgetedObjectCode()));
063: //
064: // }
065: /**
066: * Tests non budgeted object code passes for account without presence control.
067: *
068: * @throws Exception
069: */
070: public void testAccountNonPresenceNonBudgetedObject()
071: throws Exception {
072: assertTrue(
073: "non budgeted object code failed on account without presence control ",
074: SpringContext
075: .getBean(AccountPresenceService.class)
076: .isObjectCodeBudgetedForAccountPresence(
077: ACCOUNT_NON_PRESENCE_ACCOUNT
078: .createAccount(SpringContext
079: .getBean(BusinessObjectService.class)),
080: OBJECT_CODE_NON_BUDGET_OBJECT_CODE
081: .createObjectCode(SpringContext
082: .getBean(BusinessObjectService.class))));
083:
084: }
085:
086: /**
087: * Tests budgeted object code passes for account without presence control.
088: *
089: * @throws Exception
090: */
091: public void testAccountNonPresenceBudgetedObject() throws Exception {
092: assertTrue(
093: "budgeted object code failed on account without presence control ",
094: SpringContext
095: .getBean(AccountPresenceService.class)
096: .isObjectCodeBudgetedForAccountPresence(
097: ACCOUNT_NON_PRESENCE_ACCOUNT
098: .createAccount(SpringContext
099: .getBean(BusinessObjectService.class)),
100: OBJECT_CODE_BUDGETED_OBJECT_CODE
101: .createObjectCode(SpringContext
102: .getBean(BusinessObjectService.class))));
103:
104: }
105: }
|