1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.lm.employeeoverride;
17
18 import java.sql.Date;
19 import java.text.SimpleDateFormat;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.junit.Assert;
23 import org.junit.Test;
24 import org.kuali.hr.test.KPMETestCase;
25 import org.kuali.hr.time.base.web.TkInquirableImpl;
26 import org.kuali.rice.kns.lookup.HtmlData;
27 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
28
29 public class EmployeeOverrideInquirableTest extends KPMETestCase {
30
31 private String INQUIRY_URL = "inquiry.do?businessObjectClassName=org.kuali.hr.lm.accrual.AccrualCategory&methodToCall=start&effectiveDate=03%2F04%2F2012&accrualCategory=testAC&leavePlan=testLeavePlan&lmAccrualCategoryId=";
32 @Test
33 public void testGetInquiryUrl() throws Exception {
34 EmployeeOverride eo = new EmployeeOverride();
35 eo.setAccrualCategory("testAC");
36 eo.setLeavePlan("testLeavePlan");
37 Date aDate = new java.sql.Date(new SimpleDateFormat("MM/dd/yyyy").parse("03/04/2012").getTime());
38 eo.setEffectiveDate(aDate);
39
40 HtmlData hd = (HtmlData) new TkInquirableImpl().getInquiryUrl(eo, "accrualCategory", false);
41 Assert.assertNotNull("No HtmlData found", hd);
42 String inquiryUrl = ((AnchorHtmlData) hd).getHref();
43 Assert.assertTrue("Inquiry url is wrong", StringUtils.contains(inquiryUrl, INQUIRY_URL));
44
45 }
46 }