001 /**
002 * Copyright 2004-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.hr.lm.employeeoverride;
017
018 import java.sql.Date;
019 import java.text.SimpleDateFormat;
020
021 import org.apache.commons.lang.StringUtils;
022 import org.junit.Assert;
023 import org.junit.Test;
024 import org.kuali.hr.test.KPMETestCase;
025 import org.kuali.hr.time.base.web.TkInquirableImpl;
026 import org.kuali.rice.kns.lookup.HtmlData;
027 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
028
029 public class EmployeeOverrideInquirableTest extends KPMETestCase {
030
031 private String INQUIRY_URL = "inquiry.do?businessObjectClassName=org.kuali.hr.lm.accrual.AccrualCategory&methodToCall=start&effectiveDate=03%2F04%2F2012&accrualCategory=testAC&leavePlan=testLeavePlan&lmAccrualCategoryId=";
032 @Test
033 public void testGetInquiryUrl() throws Exception {
034 EmployeeOverride eo = new EmployeeOverride();
035 eo.setAccrualCategory("testAC");
036 eo.setLeavePlan("testLeavePlan");
037 Date aDate = new java.sql.Date(new SimpleDateFormat("MM/dd/yyyy").parse("03/04/2012").getTime());
038 eo.setEffectiveDate(aDate);
039
040 HtmlData hd = (HtmlData) new TkInquirableImpl().getInquiryUrl(eo, "accrualCategory", false);
041 Assert.assertNotNull("No HtmlData found", hd);
042 String inquiryUrl = ((AnchorHtmlData) hd).getHref();
043 Assert.assertTrue("Inquiry url is wrong", StringUtils.contains(inquiryUrl, INQUIRY_URL));
044
045 }
046 }