1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.calendar;
17
18 import org.joda.time.DateTimeConstants;
19 import org.joda.time.LocalTime;
20 import org.junit.Assert;
21 import org.junit.Test;
22 import org.kuali.kpme.core.api.calendar.Calendar;
23
24 import java.util.HashMap;
25 import java.util.Map;
26
27
28
29
30 public class CalendarBoTest {
31 private static Map<String, Calendar> testCalendars;
32 static {
33 testCalendars = new HashMap<String, Calendar>();
34 Calendar.Builder b = Calendar.Builder.create();
35 b.setCalendarDescriptions("Test Description");
36 b.setCalendarName("BWS-CAL");
37 b.setCalendarTypes("Pay");
38 b.setFlsaBeginDay("Sun");
39 b.setFlsaBeginLocalTime(new LocalTime(12, 0));
40 b.setFlsaBeginDayConstant(DateTimeConstants.SUNDAY);
41 b.setHrCalendarId("KPME_TEST_0001");
42 b.setVersionNumber(1L);
43 b.setObjectId("d9e94e3a-cbb7-11e3-9cd3-51a754ad6a0a");
44 testCalendars.put(b.getCalendarName(), b.build());
45
46 b.setCalendarName("LM");
47 b.setCalendarTypes("Leave");
48 b.setHrCalendarId("KPME_TEST_0002");
49 testCalendars.put(b.getCalendarName(), b.build());
50 }
51
52 public static Calendar getTestCalendar(String calendarName) {
53 return testCalendars.get(calendarName);
54 }
55
56 @Test
57 public void testCalendarConversions() {
58 Calendar immutable = CalendarBoTest.getTestCalendar("BWS-CAL");
59 CalendarBo bo = CalendarBo.from(immutable);
60
61 Assert.assertFalse(bo.equals(immutable));
62 Assert.assertFalse(immutable.equals(bo));
63 Assert.assertEquals(immutable, CalendarBo.to(bo));
64 }
65 }