View Javadoc

1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
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.hr.core.assignment;
17  
18  import java.math.BigDecimal;
19  
20  import org.junit.Assert;
21  import org.junit.Test;
22  import org.kuali.hr.KPMEWebTestCase;
23  import org.kuali.hr.util.HtmlUnitUtil;
24  import org.kuali.kpme.core.FunctionalTest;
25  import org.kuali.kpme.core.assignment.account.AssignmentAccount;
26  import org.kuali.kpme.core.util.HrTestConstants;
27  import org.kuali.rice.krad.service.KRADServiceLocator;
28  
29  import com.gargoylesoftware.htmlunit.html.HtmlPage;
30  
31  @FunctionalTest
32  public class AssignmentAccountMaintTest extends KPMEWebTestCase{
33  	private static final String TEST_CODE="CD";
34  	private static final String TEST_ID="1";
35  	private static final String TEST_ASSIGN_ID="23";
36  	private static String assignmentAccountId;
37  	private BigDecimal TEST_PERCENT =  new BigDecimal(1);
38  	
39  	@Test
40  	public void testAssignmentAccountMaint() throws Exception {	 
41  		HtmlPage assignmentAccountLookup = HtmlUnitUtil.gotoPageAndLogin(getWebClient(), HrTestConstants.Urls.ASSIGNMENT_ACCOUNT_MAINT_URL);
42  		assignmentAccountLookup = HtmlUnitUtil.clickInputContainingText(assignmentAccountLookup, "search");
43  		Assert.assertTrue("Page contains test assignmentAccount", assignmentAccountLookup.asText().contains(TEST_ASSIGN_ID.toString()));
44  		HtmlPage maintPage = HtmlUnitUtil.clickAnchorContainingText(assignmentAccountLookup, "edit",assignmentAccountId.toString());
45  		Assert.assertTrue("Maintenance Page contains test assignmentAccount",maintPage.asText().contains(TEST_ASSIGN_ID.toString()));	 
46  	}
47  
48  	@Override
49  	public void setUp() throws Exception {
50  		super.setUp();
51  		AssignmentAccount assignmentAccount = new AssignmentAccount();
52  		assignmentAccount.setAccountNbr(TEST_ID);
53  		assignmentAccount.setActive(true);
54  		assignmentAccount.setTkAssignmentId(TEST_ASSIGN_ID);
55  		assignmentAccount.setFinCoaCd(TEST_CODE);
56  		assignmentAccount.setFinObjectCd(TEST_CODE);
57  		assignmentAccount.setFinSubObjCd(TEST_CODE);
58  		assignmentAccount.setPercent(TEST_PERCENT);		
59  		KRADServiceLocator.getBusinessObjectService().save(assignmentAccount);
60  		assignmentAccountId = assignmentAccount.getTkAssignAcctId();
61  	}
62  
63  	@Override
64  	public void tearDown() throws Exception {				
65  		AssignmentAccount assignmentAccountObj = KRADServiceLocator.getBusinessObjectService().findBySinglePrimaryKey(AssignmentAccount.class, assignmentAccountId);		 
66  		KRADServiceLocator.getBusinessObjectService().delete(assignmentAccountObj);
67  		super.tearDown();
68  	}
69  	
70  }
71  
72