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