View Javadoc

1   /*
2    * Copyright 2012 The Kuali Foundation.
3    * 
4    * Licensed under the Educational Community License, Version 1.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/ecl1.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.ole.location.bo;
17  
18  import org.junit.Test;
19  import org.junit.runner.RunWith;
20  import org.kuali.ole.OleBaseTestCase;
21  import org.kuali.ole.location.bo.OleLocationLevel;
22  import org.kuali.rice.krad.service.BusinessObjectService;
23  import org.kuali.rice.krad.service.KRADServiceLocator;
24  import org.springframework.test.context.ContextConfiguration;
25  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
26  import org.springframework.test.context.transaction.TransactionConfiguration;
27  import org.springframework.transaction.annotation.Transactional;
28  
29  import static junit.framework.Assert.assertEquals;
30  
31  
32  public class OleLocationLevel_UT extends OleBaseTestCase {
33  
34      
35      private BusinessObjectService boService;
36  
37       @Test
38       @Transactional
39       public void testSave() {
40           OleLocationLevel oleLocationLevel = new OleLocationLevel();
41           oleLocationLevel.setLevelId("5000");
42           oleLocationLevel.setLevelCode("mockCode");
43           oleLocationLevel.setLevelName("mockName");
44           boService = KRADServiceLocator.getBusinessObjectService();
45           boService.save(oleLocationLevel);
46           OleLocationLevel oleLocationLevelService = boService.findBySinglePrimaryKey(OleLocationLevel.class,oleLocationLevel.getLevelId());
47           assertEquals("mockCode",oleLocationLevelService.getLevelCode());
48           assertEquals("mockName",oleLocationLevelService.getLevelName());
49      }
50  
51       @Test
52       @Transactional
53       public void testSearch(){
54           OleLocationLevel oleLocationLevel = new OleLocationLevel();
55           oleLocationLevel.setLevelId("5000");
56           oleLocationLevel.setLevelCode("mockCode");
57           oleLocationLevel.setLevelName("mockName");
58           boService = KRADServiceLocator.getBusinessObjectService();
59           boService.save(oleLocationLevel);
60           OleLocationLevel oleLocationLevelService = boService.findBySinglePrimaryKey(OleLocationLevel.class,oleLocationLevel.getLevelId());
61           assertEquals("mockCode",oleLocationLevelService.getLevelCode());
62           assertEquals("mockName",oleLocationLevelService.getLevelName());
63      }   
64  
65  }