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.joda.time.DateTimeZone;
24 import org.junit.Assert;
25 import org.junit.Test;
26 import org.kuali.hr.test.KPMETestCase;
27 import org.kuali.hr.time.service.base.TkServiceLocator;
28 import org.kuali.hr.time.timeblock.TimeBlock;
29 import org.kuali.hr.time.util.TKUtils;
30
31 public class UserPrefTest extends KPMETestCase{
32 @Test
33 public void testUserPrefFetch() throws Exception{
34 UserPreferences userPref = TkServiceLocator.getUserPreferenceService().getUserPreferences("admin");
35 Assert.assertTrue("User Pref is valid", userPref!=null && StringUtils.equals(userPref.getTimezone(),"America/Indianapolis"));
36 }
37
38 @Test
39 public void testTimeZoneTranslate() throws Exception{
40 TimeBlock tb = new TimeBlock();
41 tb.setBeginTimestamp(new Timestamp(TKUtils.getCurrentDate().getTime()));
42 tb.setEndTimestamp(new Timestamp(TKUtils.getCurrentDate().getTime()));
43
44 List<TimeBlock> tbs = new ArrayList<TimeBlock>();
45 tbs.add(tb);
46
47 TkServiceLocator.getTimezoneService().translateForTimezone(tbs, DateTimeZone.forID("America/Indianapolis"));
48 }
49
50 }