001 /** 002 * Copyright 2004-2013 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.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/ecl2.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.hr.time.assignment; 017 018 import java.math.BigDecimal; 019 020 import org.junit.Assert; 021 import org.junit.Test; 022 import org.kuali.hr.test.KPMETestCase; 023 import org.kuali.hr.time.test.HtmlUnitUtil; 024 import org.kuali.hr.time.test.TkTestConstants; 025 import org.kuali.rice.krad.service.KRADServiceLocator; 026 027 import com.gargoylesoftware.htmlunit.html.HtmlPage; 028 029 public class AssignmentAccountMaintTest extends KPMETestCase{ 030 private static final String TEST_CODE="CD"; 031 private static final String TEST_ID="1"; 032 private static final String TEST_ASSIGN_ID="23"; 033 private static String assignmentAccountId; 034 private BigDecimal TEST_PERCENT = new BigDecimal(1); 035 036 @Test 037 public void testAssignmentAccountMaint() throws Exception { 038 HtmlPage assignmentAccountLookup = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), TkTestConstants.Urls.ASSIGNMENT_ACCOUNT_MAINT_URL); 039 assignmentAccountLookup = HtmlUnitUtil.clickInputContainingText(assignmentAccountLookup, "search"); 040 Assert.assertTrue("Page contains test assignmentAccount", assignmentAccountLookup.asText().contains(TEST_ASSIGN_ID.toString())); 041 HtmlPage maintPage = HtmlUnitUtil.clickAnchorContainingText(assignmentAccountLookup, "edit",assignmentAccountId.toString()); 042 Assert.assertTrue("Maintenance Page contains test assignmentAccount",maintPage.asText().contains(TEST_ASSIGN_ID.toString())); 043 } 044 045 @Override 046 public void setUp() throws Exception { 047 super.setUp(); 048 AssignmentAccount assignmentAccount = new AssignmentAccount(); 049 assignmentAccount.setAccountNbr(TEST_ID); 050 assignmentAccount.setActive(true); 051 assignmentAccount.setTkAssignmentId(TEST_ASSIGN_ID); 052 assignmentAccount.setFinCoaCd(TEST_CODE); 053 assignmentAccount.setFinObjectCd(TEST_CODE); 054 assignmentAccount.setFinSubObjCd(TEST_CODE); 055 assignmentAccount.setPercent(TEST_PERCENT); 056 KRADServiceLocator.getBusinessObjectService().save(assignmentAccount); 057 assignmentAccountId = assignmentAccount.getTkAssignAcctId(); 058 } 059 060 @Override 061 public void tearDown() throws Exception { 062 AssignmentAccount assignmentAccountObj = KRADServiceLocator.getBusinessObjectService().findBySinglePrimaryKey(AssignmentAccount.class, assignmentAccountId); 063 KRADServiceLocator.getBusinessObjectService().delete(assignmentAccountObj); 064 super.tearDown(); 065 } 066 067 } 068 069