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