View Javadoc
1   /**
2    * Copyright 2004-2015 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.core.departmentAffiliation;
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.departmentaffiliation.DepartmentAffiliation;
26  import org.kuali.kpme.core.departmentaffiliation.DepartmentAffiliationBo;
27  public class DepartmentAffiliationBoTest {
28  
29  	    private static Map<String, DepartmentAffiliation> testDepartmentAffiliationBos;
30  	    public static DepartmentAffiliation.Builder deptAfflBuilder = DepartmentAffiliation.Builder.create();
31  	    static {
32  	    	
33  	    	testDepartmentAffiliationBos = new HashMap<String, DepartmentAffiliation>();
34  	        deptAfflBuilder.setDeptAfflType("TST-DEPTAFFL");
35  	        deptAfflBuilder.setHrDeptAfflId("KPME-TEST-0001");
36  	        deptAfflBuilder.setActive(true);
37  	        
38  	        deptAfflBuilder.setVersionNumber(1L);
39  	        deptAfflBuilder.setObjectId("0804716a-cbb7-11e3-9cd3-51a754ad6a0a");
40  	        deptAfflBuilder.setUserPrincipalId("admin");
41  	        deptAfflBuilder.setId(deptAfflBuilder.getHrDeptAfflId());
42  			deptAfflBuilder.setEffectiveLocalDate(new LocalDate(2012, 3, 1));
43  			deptAfflBuilder.setCreateTime(DateTime.now());
44  	        
45  	        testDepartmentAffiliationBos.put(deptAfflBuilder.getDeptAfflType(), deptAfflBuilder.build());
46  	        
47  	    }
48  
49  	    @Test
50  	    public void testNotEqualsWithGroup() {
51  	        DepartmentAffiliation immutable = DepartmentAffiliationBoTest.getDepartmentAffiliation("TST-DEPTAFFL");
52  	        DepartmentAffiliationBo bo = DepartmentAffiliationBo.from(immutable);
53  	        Assert.assertFalse(bo.equals(immutable));
54  	        Assert.assertFalse(immutable.equals(bo));
55  	        Assert.assertEquals(immutable, DepartmentAffiliationBo.to(bo));
56  	    }
57  
58  	    public static DepartmentAffiliation getDepartmentAffiliation(String deptAffiliation) {
59  	        return testDepartmentAffiliationBos.get(deptAffiliation);
60  	    }
61  }