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.job.service;
017
018 import java.sql.Date;
019 import java.util.List;
020
021 import junit.framework.Assert;
022
023 import org.joda.time.DateTime;
024 import org.joda.time.DateTimeZone;
025 import org.junit.Before;
026 import org.junit.Test;
027 import org.kuali.hr.job.Job;
028 import org.kuali.hr.test.KPMETestCase;
029 import org.kuali.hr.time.service.base.TkServiceLocator;
030 import org.kuali.hr.time.util.TKUtils;
031
032 public class JobServiceImplTest extends KPMETestCase {
033
034 public static final String TEST_USER = "admin";
035
036 JobService jobService = null;
037
038
039 @Before
040 public void setUp() throws Exception {
041 super.setUp();
042 jobService=TkServiceLocator.getJobService();
043 }
044
045 @Test
046 public void testGetJobs() {
047 Date payPeriodEndDate = new Date((new DateTime(2010,7,30,1,0,0,0, TKUtils.getSystemDateTimeZone())).getMillis());
048 List<Job> jobs = jobService.getJobs(TEST_USER, payPeriodEndDate);
049 Assert.assertNotNull("Jobs was null", jobs);
050 Assert.assertEquals("Incorrect number of jobs", 2, jobs.size());
051 }
052
053 @Test
054 public void testGetMaxJob() {
055 Job aJob = jobService.getMaxJob("admin");
056 Assert.assertNotNull("Max Job should not be null", aJob);
057 Assert.assertEquals("Max job number of admin should be 30", new Long("30"), aJob.getJobNumber());
058 }
059 }