1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.leave.block.history;
17
18 import java.util.List;
19
20 import junit.framework.Assert;
21
22 import org.joda.time.DateTime;
23 import org.joda.time.LocalDate;
24 import org.junit.After;
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.kuali.kpme.core.IntegrationTest;
28 import org.kuali.kpme.core.util.HrConstants;
29 import org.kuali.kpme.core.util.TKUtils;
30 import org.kuali.kpme.tklm.TKLMIntegrationTestCase;
31 import org.kuali.kpme.tklm.leave.block.LeaveBlockHistory;
32 import org.kuali.kpme.tklm.leave.block.service.LeaveBlockHistoryService;
33 import org.kuali.kpme.tklm.leave.service.LmServiceLocator;
34
35 @IntegrationTest
36 public class LeaveBlockHistoryServiceImplTest extends TKLMIntegrationTestCase {
37
38 private LeaveBlockHistoryService leaveBlockHistoryService;
39
40 @Before
41 public void setUp() throws Exception {
42 super.setUp();
43 leaveBlockHistoryService = LmServiceLocator.getLeaveBlockHistoryService();
44 }
45
46 @After
47 public void tearDown() throws Exception {
48 super.tearDown();
49 }
50
51 @Test
52 public void testGetLeaveBlockHistoryByLmLeaveBlockId() {
53 List<LeaveBlockHistory> leaveBlockHistories = leaveBlockHistoryService.getLeaveBlockHistoryByLmLeaveBlockId("1000");
54 Assert.assertNotNull("Leave Block histories not found ", leaveBlockHistories);
55 }
56
57 @Test
58 public void testGetLeaveBlockHistories() {
59 List<LeaveBlockHistory> leaveBlockHistories = leaveBlockHistoryService.getLeaveBlockHistories("admin", null);
60 Assert.assertNotNull("Leave Block histories not found ", leaveBlockHistories);
61 }
62
63 @Test
64 public void testGetLeaveBlockHistoriesForLeaveDisplay() {
65 LocalDate beginDate = new LocalDate(2012, 1, 1);
66 LocalDate endDate = new LocalDate(2012, 12, 31);
67 List<LeaveBlockHistory> leaveBlockHistories= leaveBlockHistoryService.getLeaveBlockHistoriesForLeaveDisplay("admin", beginDate, endDate, Boolean.TRUE);
68 Assert.assertNotNull("Leave Block histories for leavedisplay not found ", leaveBlockHistories);
69 }
70 @Test
71 public void testGetLeaveBlockHistoriesWithStatusAndAction() {
72 DateTime currentDate = new DateTime(2012, 3, 10, 0, 0, 0, 0, TKUtils.getSystemDateTimeZone());
73 List<LeaveBlockHistory> leaveBlockHistories= leaveBlockHistoryService.getLeaveBlockHistories("admin", HrConstants.REQUEST_STATUS.DISAPPROVED, HrConstants.ACTION.DELETE, currentDate.toLocalDate());
74 Assert.assertNotNull("Leave Block histories for leavedisplay not found ", leaveBlockHistories);
75 Assert.assertTrue("There should be 1 leave block history found, not " + leaveBlockHistories.size() , leaveBlockHistories.size() == 1);
76 }
77
78
79 }