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.job.service;
17  
18  import java.sql.Date;
19  import java.util.List;
20  
21  import junit.framework.Assert;
22  
23  import org.joda.time.DateTime;
24  import org.joda.time.DateTimeZone;
25  import org.junit.Before;
26  import org.junit.Test;
27  import org.kuali.hr.job.Job;
28  import org.kuali.hr.test.KPMETestCase;
29  import org.kuali.hr.time.service.base.TkServiceLocator;
30  import org.kuali.hr.time.util.TKUtils;
31  
32  public class JobServiceImplTest extends KPMETestCase {
33  
34  	public static final String TEST_USER = "admin";
35  
36  	JobService jobService = null;
37  	
38  
39  	@Before
40  	public void setUp() throws Exception {
41  		super.setUp();
42  		jobService=TkServiceLocator.getJobService();
43  	}
44  	
45  	@Test
46  	public void testGetJobs() {
47  		Date payPeriodEndDate = new Date((new DateTime(2010,7,30,1,0,0,0, TKUtils.getSystemDateTimeZone())).getMillis());
48  		List<Job> jobs = jobService.getJobs(TEST_USER, payPeriodEndDate);
49  		Assert.assertNotNull("Jobs was null", jobs);
50  		Assert.assertEquals("Incorrect number of jobs", 2, jobs.size());
51  	}
52  	
53  	@Test
54  	public void testGetMaxJob() {
55  		Job aJob = jobService.getMaxJob("admin");
56  		Assert.assertNotNull("Max Job should not be null", aJob);
57  		Assert.assertEquals("Max job number of admin should be 30", new Long("30"), aJob.getJobNumber());
58  	}
59  }