View Javadoc
1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.kpme.pm.classification.qual;
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.pm.api.classification.Classification;
25  import org.kuali.kpme.pm.api.classification.qual.ClassificationQualification;
26  import org.kuali.kpme.pm.classification.ClassificationBo;
27  import org.kuali.kpme.pm.classification.ClassificationBoTest;
28  import org.kuali.kpme.pm.position.PositionBo;
29  
30  
31  public class ClassificationQualificationBoTest {
32  	private static Map<String, ClassificationQualification> testClassificationQualificationBos;
33  	public static ClassificationQualification.Builder classificationQualificationBoBuilder = ClassificationQualification.Builder
34  			.create();
35  
36  	static LocalDate currentTime = new LocalDate();
37  	
38  	static{
39  		
40  		testClassificationQualificationBos = new HashMap<String, ClassificationQualification>();
41  		
42  		classificationQualificationBoBuilder.setQualificationValue("QLFCTN-VALUE");
43          classificationQualificationBoBuilder.setQualificationType("");
44          classificationQualificationBoBuilder.setDisplayOrder("DISPLAYORDER");
45          classificationQualificationBoBuilder.setTypeValue("");
46          classificationQualificationBoBuilder.setQualifier("QUALIFIER");
47          classificationQualificationBoBuilder.setPmClassificationQualificationId("TST-CLASSFCTNQLFCTN");
48          classificationQualificationBoBuilder.setPmPositionClassId("TST-PMCLASSID");
49          classificationQualificationBoBuilder.setEffectiveLocalDateOfOwner(currentTime);
50  //        classificationQualificationBoBuilder.setOwner(Classification.Builder.create(ClassificationBoTest.getClassification("TST-PMCLASSID")));
51          classificationQualificationBoBuilder.setVersionNumber(1L);
52          classificationQualificationBoBuilder.setObjectId("0804716a-cbb7-11e3-9cd3-51a754ad6a0a");
53  		
54  		testClassificationQualificationBos.put(classificationQualificationBoBuilder.getPmClassificationQualificationId(), classificationQualificationBoBuilder.build());
55  		
56  	}
57  	
58  
59  	@Test
60      public void testNotEqualsWithGroup() {
61      	ClassificationQualification immutable = ClassificationQualificationBoTest.getClassificationQualificationBo("TST-CLASSFCTNQLFCTN");
62      	ClassificationQualificationBo bo = ClassificationQualificationBo.from(immutable);
63      	
64      	ClassificationBo classificationBo = new ClassificationBo();
65  		classificationBo.setEffectiveLocalDate(currentTime);
66  		bo.setOwner(classificationBo);
67      	
68  		System.out.println("Bo ... "+bo.getEffectiveDateOfOwner());
69          Assert.assertFalse(bo.equals(immutable));
70          Assert.assertFalse(immutable.equals(bo));
71          System.out.println("Immutable ,.. "+immutable.getEffectiveLocalDateOfOwner());
72          Assert.assertEquals(immutable, ClassificationQualificationBo.to(bo));
73      }
74  
75      public static ClassificationQualification getClassificationQualificationBo(String classificationQualification) {
76          return testClassificationQualificationBos.get(classificationQualification);
77      }
78  
79  }