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.core.paystep;
17  
18  import java.math.BigDecimal;
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  import org.joda.time.DateTime;
23  import org.joda.time.LocalDate;
24  import org.junit.Assert;
25  import org.junit.Test;
26  import org.kuali.kpme.core.api.paystep.PayStep;
27  
28  public class PayStepBoTest {
29  
30  	    private static Map<String, PayStep> testPayStepBos;
31  	    public static PayStep.Builder payStepBuilder = PayStep.Builder.create("TST-PAYSTEP");
32  	    static {
33  	    	
34  	    	testPayStepBos = new HashMap<String, PayStep>();
35  	        payStepBuilder.setPmPayStepId("KPME-TEST-0001");
36  	        payStepBuilder.setPayStep("TST-PAYSTEP");
37  	        payStepBuilder.setPayGrade("PS5");
38  	        payStepBuilder.setCompRate(new BigDecimal(500));
39  	        payStepBuilder.setSalaryGroup("HR");
40  	        payStepBuilder.setStepNumber(2);
41  	        payStepBuilder.setServiceAmount(100);
42  	        payStepBuilder.setServiceUnit("M");
43  	        payStepBuilder.setActive(true);
44  	        
45  	        payStepBuilder.setVersionNumber(1L);
46  	        payStepBuilder.setObjectId("0804716a-cbb7-11e3-9cd3-51a754ad6a0a");
47  	        payStepBuilder.setUserPrincipalId("admin");
48  	        payStepBuilder.setId(payStepBuilder.getPmPayStepId());
49  			payStepBuilder.setEffectiveLocalDate(new LocalDate(2012, 3, 1));
50  			payStepBuilder.setCreateTime(DateTime.now());
51  			
52  	        testPayStepBos.put(payStepBuilder.getPayStep(), payStepBuilder.build());
53  	        
54  	    }
55  
56  	    @Test
57  	    public void testNotEqualsWithGroup() {
58  	        PayStep immutable = PayStepBoTest.getPayStep("TST-PAYSTEP");
59  	        PayStepBo bo = PayStepBo.from(immutable);
60  	        Assert.assertFalse(bo.equals(immutable));
61  	        Assert.assertFalse(immutable.equals(bo));
62  	        Assert.assertEquals(immutable, PayStepBo.to(bo));
63  	    }
64  
65  	    public static PayStep getPayStep(String payStep) {
66  	        return testPayStepBos.get(payStep);
67  	    }
68  }