1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.assignment.service;
17
18 import java.sql.Date;
19 import java.util.List;
20
21 import org.apache.log4j.Logger;
22 import org.joda.time.DateTime;
23 import org.joda.time.DateTimeZone;
24 import org.junit.Assert;
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.kuali.hr.test.KPMETestCase;
28 import org.kuali.hr.time.assignment.Assignment;
29 import org.kuali.hr.time.assignment.dao.AssignmentDao;
30 import org.kuali.hr.time.service.base.TkServiceLocator;
31 import org.kuali.hr.time.util.TKUtils;
32
33 public class AssignmentServiceImplTest extends KPMETestCase {
34
35 private static final Logger LOG = Logger.getLogger(AssignmentServiceImplTest.class);
36 AssignmentDao assignmentDao = null;
37 AssignmentService assignmentService = null;
38
39 @Before
40 public void setUp() throws Exception {
41 super.setUp();
42 assignmentDao = TkServiceLocator.getAssignmentDao();
43 assignmentService=TkServiceLocator.getAssignmentService();
44 }
45
46 @Test
47 public void testGetAssignments() throws Exception {
48 List<Assignment> assignments = assignmentService.getAssignments("admin", new Date((new DateTime(2010,8,5,1,0,0,0, TKUtils.getSystemDateTimeZone())).getMillis()));
49 Assert.assertNotNull("Null assignment list", assignments);
50 Assert.assertTrue("No assignments found", assignments.size() > 0);
51
52 for(Assignment assign : assignments){
53 Assert.assertNotNull("Null job found", assign.getJob());
54 Assert.assertTrue("Job number is same", assign.getJob().getJobNumber().compareTo(assign.getJobNumber())==0);
55 }
56
57 }
58
59 }