001/** 002 * Copyright 2004-2014 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 */ 016package org.kuali.hr.time.workflow; 017 018import org.joda.time.DateTime; 019import org.junit.Assert; 020import org.junit.Test; 021import org.kuali.hr.KPMEWebTestCase; 022import org.kuali.kpme.core.FunctionalTest; 023import org.kuali.kpme.core.util.TKUtils; 024import org.kuali.kpme.tklm.time.service.TkServiceLocator; 025import org.kuali.kpme.tklm.time.workflow.TimesheetDocumentHeader; 026 027@FunctionalTest 028public class TimesheetDocumentHeaderServiceImplTest extends KPMEWebTestCase { 029 030 @Test 031 public void testGetDocumentHeaderForDate() { 032 String principalId = "admin"; 033 // there is NO TimesheetDocumentHeader that covers 05/03/2012 034 DateTime asOfDate = new DateTime(2012, 5, 3, 0, 0, 0, 0, TKUtils.getSystemDateTimeZone()); 035 TimesheetDocumentHeader tdh = TkServiceLocator.getTimesheetDocumentHeaderService().getDocumentHeaderForDate(principalId,asOfDate); 036 Assert.assertNull("TimesheetDocumentHeader for 05/03/2012 should be null.", tdh); 037 038 // there is a TimesheetDocumentHeader that covers 03/08/2012 039 asOfDate = new DateTime(2012, 3, 8, 0, 0, 0, 0, TKUtils.getSystemDateTimeZone()); 040 tdh = TkServiceLocator.getTimesheetDocumentHeaderService().getDocumentHeaderForDate(principalId,asOfDate); 041 Assert.assertNotNull("TimesheetDocumentHeader for 03/08/2012 should NOT be null.", tdh); 042 } 043 044 045}