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.time.workflow.service;
017
018 import java.util.Date;
019
020 import org.joda.time.DateTime;
021 import org.junit.Assert;
022 import org.junit.Test;
023 import org.kuali.hr.test.KPMETestCase;
024 import org.kuali.hr.time.service.base.TkServiceLocator;
025 import org.kuali.hr.time.util.TKUtils;
026 import org.kuali.hr.time.workflow.TimesheetDocumentHeader;
027
028 public class TimesheetDocumentHeaderServiceImplTest extends KPMETestCase {
029
030 @Test
031 public void testGetDocumentHeaderForDate() {
032 String principalId = "admin";
033 // there is NO TimesheetDocumentHeader that covers 05/03/2012
034 Date asOfDate = new Date((new DateTime(2012, 5, 3, 0, 0, 0, 0, TKUtils.getSystemDateTimeZone())).getMillis());
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 Date((new DateTime(2012, 3, 8, 0, 0, 0, 0, TKUtils.getSystemDateTimeZone())).getMillis());
040 tdh = TkServiceLocator.getTimesheetDocumentHeaderService().getDocumentHeaderForDate(principalId,asOfDate);
041 Assert.assertNotNull("TimesheetDocumentHeader for 03/08/2012 should NOT be null.", tdh);
042 }
043
044
045 }