1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.earngroup.service;
17
18 import java.sql.Date;
19
20 import org.apache.commons.lang.StringUtils;
21 import org.junit.Assert;
22 import org.junit.Test;
23 import org.kuali.hr.test.KPMETestCase;
24 import org.kuali.hr.time.earngroup.EarnGroup;
25 import org.kuali.hr.time.service.base.TkServiceLocator;
26 import org.kuali.hr.time.test.HtmlUnitUtil;
27 import org.kuali.hr.time.test.TkTestConstants;
28
29 import com.gargoylesoftware.htmlunit.html.HtmlPage;
30
31 public class EarnGroupServiceTest extends KPMETestCase{
32 @Test
33 public void testEarnGroupFetch() throws Exception{
34 EarnGroup earnGroup = TkServiceLocator.getEarnGroupService().getEarnGroup("REG", new Date(System.currentTimeMillis()));
35 Assert.assertTrue("Test Earn Group fetch failed", earnGroup!=null && StringUtils.equals("REG", earnGroup.getEarnGroup()));
36 Assert.assertTrue("Test earn group def fetch failed", earnGroup.getEarnGroups()!=null && earnGroup.getEarnGroups().get(0).getHrEarnGroupId().equals("100"));
37 }
38
39 @Test
40 public void testEarnGroupMaintenancePage() throws Exception{
41 HtmlPage earnCodeLookUp = HtmlUnitUtil.gotoPageAndLogin(TkTestConstants.Urls.EARN_GROUP_MAINT_URL);
42 earnCodeLookUp = HtmlUnitUtil.clickInputContainingText(earnCodeLookUp, "search");
43 HtmlUnitUtil.createTempFile(earnCodeLookUp);
44 Assert.assertTrue("Page contains REG entry", earnCodeLookUp.asText().contains("REG"));
45
46 EarnGroup earnGroup = TkServiceLocator.getEarnGroupService().getEarnGroup("REG", new Date(System.currentTimeMillis()));
47 String earnGroupId = earnGroup.getHrEarnGroupId().toString();
48 HtmlPage maintPage = HtmlUnitUtil.clickAnchorContainingText(earnCodeLookUp, "edit", earnGroupId);
49 HtmlUnitUtil.createTempFile(maintPage);
50 Assert.assertTrue("Maintenance Page contains REG entry",maintPage.asText().contains("REG"));
51 }
52 }