1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.user.pref;
17
18 import java.sql.Timestamp;
19 import java.util.ArrayList;
20 import java.util.List;
21
22 import org.apache.commons.lang.StringUtils;
23 import org.junit.Assert;
24 import org.junit.Test;
25 import org.kuali.hr.test.KPMETestCase;
26 import org.kuali.hr.time.service.base.TkServiceLocator;
27 import org.kuali.hr.time.timeblock.TimeBlock;
28 import org.kuali.hr.time.util.TKUtils;
29
30 public class UserPrefTest extends KPMETestCase{
31 @Test
32 public void testUserPrefFetch() throws Exception{
33 UserPreferences userPref = TkServiceLocator.getUserPreferenceService().getUserPreferences("admin");
34 Assert.assertTrue("User Pref is valid", userPref!=null && StringUtils.equals(userPref.getTimezone(),"America/Indianapolis"));
35 }
36
37 @Test
38 public void testTimeZoneTranslate() throws Exception{
39 TimeBlock tb = new TimeBlock();
40 tb.setBeginTimestamp(new Timestamp(TKUtils.getCurrentDate().getTime()));
41 tb.setEndTimestamp(new Timestamp(TKUtils.getCurrentDate().getTime()));
42
43 List<TimeBlock> tbs = new ArrayList<TimeBlock>();
44 tbs.add(tb);
45
46 TkServiceLocator.getTimezoneService().translateForTimezone(tbs, "America/Indianapolis");
47 }
48
49 }