1
2
3
4
5
6
7
8
9
10
11
12
13
14
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