View Javadoc

1   /**
2    * Copyright 2004-2013 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.time.assignment;
17  
18  import java.math.BigDecimal;
19  
20  import org.junit.Assert;
21  import org.junit.Test;
22  import org.kuali.hr.test.KPMETestCase;
23  import org.kuali.hr.time.test.HtmlUnitUtil;
24  import org.kuali.hr.time.test.TkTestConstants;
25  import org.kuali.rice.krad.service.KRADServiceLocator;
26  
27  import com.gargoylesoftware.htmlunit.html.HtmlPage;
28  
29  public class AssignmentAccountMaintTest extends KPMETestCase{
30  	private static final String TEST_CODE="CD";
31  	private static final String TEST_ID="1";
32  	private static final String TEST_ASSIGN_ID="23";
33  	private static String assignmentAccountId;
34  	private BigDecimal TEST_PERCENT =  new BigDecimal(1);
35  	
36  	@Test
37  	public void testAssignmentAccountMaint() throws Exception {	 
38  		HtmlPage assignmentAccountLookup = HtmlUnitUtil.gotoPageAndLogin(TkTestConstants.Urls.ASSIGNMENT_ACCOUNT_MAINT_URL);
39  		assignmentAccountLookup = HtmlUnitUtil.clickInputContainingText(assignmentAccountLookup, "search");
40  		Assert.assertTrue("Page contains test assignmentAccount", assignmentAccountLookup.asText().contains(TEST_ASSIGN_ID.toString()));
41  		HtmlPage maintPage = HtmlUnitUtil.clickAnchorContainingText(assignmentAccountLookup, "edit",assignmentAccountId.toString());
42  		Assert.assertTrue("Maintenance Page contains test assignmentAccount",maintPage.asText().contains(TEST_ASSIGN_ID.toString()));	 
43  	}
44  
45  	@Override
46  	public void setUp() throws Exception {
47  		super.setUp();
48  		AssignmentAccount assignmentAccount = new AssignmentAccount();
49  		assignmentAccount.setAccountNbr(TEST_ID);
50  		assignmentAccount.setActive(true);
51  		assignmentAccount.setTkAssignmentId(TEST_ASSIGN_ID);
52  		assignmentAccount.setFinCoaCd(TEST_CODE);
53  		assignmentAccount.setFinObjectCd(TEST_CODE);
54  		assignmentAccount.setFinSubObjCd(TEST_CODE);
55  		assignmentAccount.setPercent(TEST_PERCENT);		
56  		KRADServiceLocator.getBusinessObjectService().save(assignmentAccount);
57  		assignmentAccountId = assignmentAccount.getTkAssignAcctId();
58  	}
59  
60  	@Override
61  	public void tearDown() throws Exception {				
62  		AssignmentAccount assignmentAccountObj = KRADServiceLocator.getBusinessObjectService().findBySinglePrimaryKey(AssignmentAccount.class, assignmentAccountId);		 
63  		KRADServiceLocator.getBusinessObjectService().delete(assignmentAccountObj);
64  		super.tearDown();
65  	}
66  	
67  }
68  
69