1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.position;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import org.joda.time.LocalDate;
22 import org.junit.Assert;
23 import org.junit.Test;
24 import org.kuali.kpme.core.api.groupkey.HrGroupKey;
25 import org.kuali.kpme.core.api.position.PositionBase;
26 import org.kuali.kpme.core.groupkey.HrGroupKeyBoTest;
27
28 public class PositionBaseBoTest {
29
30 private static Map<String, PositionBase> testPositionBaseBos;
31 public static PositionBase.Builder PositionBaseBuilder = PositionBase.Builder.create("TST-PSTNNUM");
32 private static final LocalDate currentTime = new LocalDate();
33
34 static {
35 testPositionBaseBos = new HashMap<String, PositionBase>();
36 PositionBaseBuilder.setActive(true);
37 PositionBaseBuilder.setPositionNumber("TST-PSTNNUM");
38 PositionBaseBuilder.setHrPositionId("TST-PSTNID");
39 PositionBaseBuilder.setDescription("Testing");
40 PositionBaseBuilder.setGroupKeyCode("ISU-IA");
41 PositionBaseBuilder.setGroupKey(HrGroupKey.Builder.create(HrGroupKeyBoTest.getTestHrGroupKey("ISU-IA")));
42 PositionBaseBuilder.setId(PositionBaseBuilder.getHrPositionId());
43 PositionBaseBuilder.setVersionNumber(1L);
44 PositionBaseBuilder.setEffectiveLocalDate(currentTime);
45 PositionBaseBuilder.setObjectId("0804716a-cbb7-11e3-9cd3-51a754ad6a0a");
46 testPositionBaseBos.put(PositionBaseBuilder.getPositionNumber(), PositionBaseBuilder.build());
47 }
48
49 @Test
50 public void testNotEqualsWithGroup() {
51 PositionBase immutable = PositionBaseBoTest.getPositionBase("TST-PSTNNUM");
52 PositionBaseBo bo = PositionBaseBo.from(immutable);
53 Assert.assertFalse(bo.equals(immutable));
54 Assert.assertFalse(immutable.equals(bo));
55 Assert.assertEquals(immutable, PositionBaseBo.to(bo));
56 }
57
58 public static PositionBase getPositionBase(String positionNumber) {
59 return testPositionBaseBos.get(positionNumber);
60 }
61
62 }