1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.pm.appointment;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import org.joda.time.DateTime;
22 import org.joda.time.LocalDate;
23 import org.junit.Assert;
24 import org.junit.Test;
25 import org.kuali.kpme.core.api.groupkey.HrGroupKey;
26 import org.kuali.kpme.core.groupkey.HrGroupKeyBoTest;
27 import org.kuali.kpme.pm.api.positionappointment.PositionAppointment;
28 import org.kuali.kpme.pm.positionappointment.PositionAppointmentBo;
29
30 public class PositionAppointmentBoTest {
31 private static Map<String, PositionAppointment> testPositionAppointmentBos;
32 public static PositionAppointment.Builder positionAppointmentBuilder = PositionAppointment.Builder.create("ISU-IA", "TST-PSTNAPPMNT");
33
34 static {
35 testPositionAppointmentBos = new HashMap<String, PositionAppointment>();
36 positionAppointmentBuilder.setGroupKeyCode("ISU-IA");
37 positionAppointmentBuilder.setDescription("Testing Immutable PositionAppointment");
38 positionAppointmentBuilder.setPositionAppointment("TST-PSTNAPPMNT");
39 positionAppointmentBuilder.setUserPrincipalId("admin");
40
41 positionAppointmentBuilder.setPmPositionAppointmentId("KPME_TEST_0001");
42 positionAppointmentBuilder.setVersionNumber(1L);
43 positionAppointmentBuilder.setObjectId("0804716a-cbb7-11e3-9cd3-51a754ad6a0a");
44 positionAppointmentBuilder.setActive(true);
45 positionAppointmentBuilder.setId(positionAppointmentBuilder.getPmPositionAppointmentId());
46 positionAppointmentBuilder.setEffectiveLocalDate(new LocalDate(2012, 3, 1));
47 positionAppointmentBuilder.setCreateTime(DateTime.now());
48
49
50 positionAppointmentBuilder.setGroupKey(HrGroupKey.Builder.create(HrGroupKeyBoTest.getTestHrGroupKey("ISU-IA")));
51 testPositionAppointmentBos.put(positionAppointmentBuilder.getPositionAppointment(), positionAppointmentBuilder.build());
52 }
53
54 @Test
55 public void testNotEqualsWithGroup() {
56 PositionAppointment immutable = PositionAppointmentBoTest.getPositionAppointment("TST-PSTNAPPMNT");
57 PositionAppointmentBo bo = PositionAppointmentBo.from(immutable);
58 Assert.assertFalse(bo.equals(immutable));
59 Assert.assertFalse(immutable.equals(bo));
60 Assert.assertEquals(immutable, PositionAppointmentBo.to(bo));
61 }
62
63 public static PositionAppointment getPositionAppointment(String positionAppointment) {
64 return testPositionAppointmentBos.get(positionAppointment);
65 }
66 }