1 package org.kuali.ole.catalog.bo;
2
3 import org.junit.Test;
4 import org.junit.runner.RunWith;
5 import org.kuali.rice.krad.service.BusinessObjectService;
6 import org.kuali.rice.krad.service.KRADServiceLocator;
7 import org.springframework.test.context.ContextConfiguration;
8 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
9 import org.springframework.test.context.transaction.TransactionConfiguration;
10 import org.springframework.transaction.annotation.Transactional;
11
12 import static junit.framework.Assert.assertEquals;
13
14
15
16
17
18
19
20
21
22 @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
23 @RunWith(value = SpringJUnit4ClassRunner.class)
24 @TransactionConfiguration(defaultRollback = true)
25 public class OleEncodingLevel_UT {
26 private BusinessObjectService boService;
27 @Test
28 @Transactional
29 public void testSave() {
30 OleEncodingLevel encodingLevel = new OleEncodingLevel();
31 encodingLevel.setEncodingLevelId(1);
32 encodingLevel.setEncodingLevelCode("testCode");
33 encodingLevel.setEncodingLevelName("testName");
34 encodingLevel.setSource("testSource");
35 encodingLevel.setActive(true);
36 boService = KRADServiceLocator.getBusinessObjectService();
37 boService.save(encodingLevel);
38 OleEncodingLevel encodingLevelService = boService.findBySinglePrimaryKey(OleEncodingLevel.class,encodingLevel.getEncodingLevelId());
39 assertEquals("testCode",encodingLevelService.getEncodingLevelCode());
40 assertEquals("testName",encodingLevelService.getEncodingLevelName());
41 }
42 @Test
43 @Transactional
44 public void testSearch() {
45 OleEncodingLevel encodingLevel = new OleEncodingLevel();
46 encodingLevel.setEncodingLevelId(2);
47 encodingLevel.setEncodingLevelCode("testCode");
48 encodingLevel.setEncodingLevelName("testName");
49 encodingLevel.setSource("testSource");
50 encodingLevel.setActive(true);
51 boService = KRADServiceLocator.getBusinessObjectService();
52 boService.save(encodingLevel);
53 OleEncodingLevel encodingLevelService = boService.findBySinglePrimaryKey(OleEncodingLevel.class,encodingLevel.getEncodingLevelId());
54 assertEquals("testCode",encodingLevelService.getEncodingLevelCode());
55 assertEquals("testName",encodingLevelService.getEncodingLevelName());
56 }
57 }