1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.leaveplan;
17
18 import org.joda.time.DateTime;
19 import org.joda.time.LocalDate;
20 import org.joda.time.LocalTime;
21 import org.junit.Assert;
22 import org.junit.Test;
23 import org.kuali.kpme.core.api.leaveplan.LeavePlan;
24
25 import java.util.HashMap;
26 import java.util.Map;
27
28
29
30
31 public class LeavePlanBoTest {
32 private static Map<String, LeavePlan> testLeavePlans;
33 static {
34 testLeavePlans = new HashMap<String, LeavePlan>();
35 LeavePlan.Builder b = LeavePlan.Builder.create("LEAVE");
36
37 b.setVersionNumber(1L);
38 b.setBatchPriorYearCarryOverStartLocalTime(new LocalTime(20, 0));
39 b.setPlanningMonths("12");
40 b.setLmLeavePlanId("KPME_TEST_001");
41 b.setDescr("Leave Plan");
42 b.setCalendarYearStart("01/01");
43 b.setBatchPriorYearCarryOverStartDate("02/01");
44 b.setVersionNumber(1L);
45 b.setActive(true);
46 b.setId(b.getLmLeavePlanId());
47 b.setEffectiveLocalDate(new LocalDate(2010, 1, 1));
48 b.setCreateTime(DateTime.now());
49 b.setObjectId("ac1c2c7c-cbba-11e3-9cd3-51a754ad6a0a");
50 testLeavePlans.put(b.getLeavePlan(), b.build());
51
52 }
53
54 public static LeavePlan getLeavePlan(String leavePlan) {
55 return testLeavePlans.get(leavePlan);
56 }
57
58 @Test
59 public void testLeavePlanConversions() {
60 LeavePlan immutable = LeavePlanBoTest.getLeavePlan("LEAVE");
61 LeavePlanBo bo = LeavePlanBo.from(immutable);
62
63 Assert.assertFalse(bo.equals(immutable));
64 Assert.assertFalse(immutable.equals(bo));
65 Assert.assertEquals(immutable, LeavePlanBo.to(bo));
66 }
67 }