1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.pm.classification.flag;
17
18 import java.util.ArrayList;
19 import java.util.HashMap;
20 import java.util.List;
21 import java.util.Map;
22
23 import org.joda.time.LocalDate;
24 import org.junit.Assert;
25 import org.junit.Test;
26 import org.kuali.kpme.pm.api.classification.Classification;
27 import org.kuali.kpme.pm.api.classification.flag.ClassificationFlag;
28 import org.kuali.kpme.pm.classification.ClassificationBo;
29 import org.kuali.kpme.pm.classification.ClassificationBoTest;
30
31 public class ClassificationFlagBoTest {
32
33
34 private static Map<String, ClassificationFlag> testClassificationFlagBos;
35 public static ClassificationFlag.Builder classificationFlagBuilder = ClassificationFlag.Builder.create();
36 public static LocalDate currentTime = LocalDate.now();
37
38 static{
39 testClassificationFlagBos = new HashMap<String, ClassificationFlag>();
40
41 classificationFlagBuilder.setObjectId("0804716a-cbb7-11e3-9cd3-51a754ad6a0a");
42 classificationFlagBuilder.setVersionNumber(1l);
43 List<String> names = new ArrayList<String>();
44 names.add("Name1");
45 classificationFlagBuilder.setNames(names);
46 classificationFlagBuilder.setCategory("CAT");
47 classificationFlagBuilder.setPmFlagId("TST-CLSFCTNFLAG");
48 classificationFlagBuilder.setPmPositionClassId("TST-PMCLASSID");
49 classificationFlagBuilder.setEffectiveLocalDateOfOwner(currentTime);
50
51 testClassificationFlagBos.put(classificationFlagBuilder.getPmFlagId(), classificationFlagBuilder.build());
52
53 }
54
55 @Test
56 public void testNotEqualsWithGroup() {
57 ClassificationFlag immutable = ClassificationFlagBoTest.getClassificationFlag("TST-CLSFCTNFLAG");
58 ClassificationFlagBo bo = ClassificationFlagBo.from(immutable);
59
60 ClassificationBo classificationBo = new ClassificationBo();
61 classificationBo.setEffectiveLocalDate(currentTime);
62 bo.setOwner(classificationBo);
63
64 Assert.assertFalse(bo.equals(immutable));
65 Assert.assertFalse(immutable.equals(bo));
66 Assert.assertEquals(immutable, ClassificationFlagBo.to(bo));
67 }
68
69 public static ClassificationFlag getClassificationFlag(String classificationFlag) {
70 return testClassificationFlagBos.get(classificationFlag);
71 }
72 }