1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.clocklog.service;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.junit.Assert;
22 import org.junit.Test;
23 import org.kuali.hr.test.KPMETestCase;
24 import org.kuali.hr.time.service.base.TkServiceLocator;
25 import org.kuali.hr.time.timeblock.TimeBlock;
26
27 public class ClockLogServiceTest extends KPMETestCase {
28
29 @Test
30 public void testGetUnapprovedIPWarning() throws Exception {
31 List<TimeBlock> tbLists = new ArrayList<TimeBlock>();
32 TimeBlock timeBlock = new TimeBlock();
33 timeBlock.setUserPrincipalId("testUser");
34 timeBlock.setClockLogCreated(true);
35 timeBlock.setClockLogEndId("5000");
36 tbLists.add(timeBlock);
37
38 List<String> warningList = TkServiceLocator.getClockLogService().getUnapprovedIPWarning(tbLists);
39 Assert.assertTrue("There should be 1 warning message ", warningList.size()== 1);
40 String warning = warningList.get(0);
41 Assert.assertTrue("Warning message should be 'Warning: Action 'Clock Out' taken at 2012-03-01 08:08:08.0 was from an unapproved IP address - TEST', not " + warning,
42 warning.equals("Warning: Action 'Clock Out' taken at 2012-03-01 08:08:08.0 was from an unapproved IP address - TEST"));
43
44 }
45 }