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.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  }