1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.pm.position;
17
18 import java.util.*;
19
20 import org.joda.time.LocalDate;
21 import org.junit.Assert;
22 import org.junit.Test;
23 import org.kuali.kpme.pm.api.position.Position;
24 import org.kuali.kpme.pm.api.position.PstnFlag;
25
26 public class PstnFlagBoTest {
27 private static Map<String, PstnFlag> testPstnFlagBos;
28 public static PstnFlag.Builder pstnFlagBuilder = PstnFlag.Builder.create();
29 static LocalDate currentTime = new LocalDate();
30
31 static {
32
33 testPstnFlagBos = new HashMap<String, PstnFlag>();
34
35 List<String> names = new ArrayList<String>();
36 names.add("Name1");
37 pstnFlagBuilder.setCategory("CAT");
38 pstnFlagBuilder.setHrPositionId("");
39 pstnFlagBuilder.setNames(names);
40 pstnFlagBuilder.setObjectId("0804716a-cbb7-11e3-9cd3-51a754ad6a0a");
41 pstnFlagBuilder.setEffectiveLocalDateOfOwner(currentTime);
42
43 pstnFlagBuilder.setPmFlagId("TST-PSTNFLAG");
44 pstnFlagBuilder.setVersionNumber(1L);
45
46
47 testPstnFlagBos.put(pstnFlagBuilder.getPmFlagId(),pstnFlagBuilder.build());
48 System.out.println(testPstnFlagBos);
49 }
50
51 @Test
52 public void testNotEqualsWithGroup() {
53 PstnFlag immutable = PstnFlagBoTest.getPstnFlag("TST-PSTNFLAG");
54 PstnFlagBo bo = PstnFlagBo.from(immutable);
55
56 PositionBo positionBo = new PositionBo();
57 positionBo.setEffectiveLocalDate(currentTime);
58 bo.setOwner(positionBo);
59
60 Assert.assertFalse(bo.equals(immutable));
61 Assert.assertFalse(immutable.equals(bo));
62 Assert.assertEquals(immutable, PstnFlagBo.to(bo));
63 }
64
65 public static PstnFlag getPstnFlag(String pstnFlag) {
66 PstnFlag pstnFlag1 = testPstnFlagBos.get(pstnFlag);
67 return pstnFlag1;
68 }
69
70 }