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 @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
22 @RunWith(value = SpringJUnit4ClassRunner.class)
23 @TransactionConfiguration(defaultRollback = true)
24 public class OleCompleteness_UT {
25
26 private BusinessObjectService boService;
27
28 @Test
29 @Transactional
30 public void testSave() {
31 OleCompleteness completeness = new OleCompleteness();
32 completeness.setCompletenessId(1);
33 completeness.setCompletenessCode("testCode");
34 completeness.setCompletenessName("testName");
35 completeness.setSource("testSource");
36 completeness.setActive(true);
37 boService = KRADServiceLocator.getBusinessObjectService();
38 boService.save(completeness);
39 OleCompleteness completenessService = boService.findBySinglePrimaryKey(OleCompleteness.class,completeness.getCompletenessId());
40 assertEquals("testCode",completenessService.getCompletenessCode());
41 assertEquals("testName",completenessService.getCompletenessName());
42 }
43
44 @Test
45 @Transactional
46 public void testSearch(){
47 OleCompleteness completeness = new OleCompleteness();
48 completeness.setCompletenessId(2);
49 completeness.setCompletenessCode("testCode");
50 completeness.setCompletenessName("testName");
51 completeness.setActive(true);
52 boService = KRADServiceLocator.getBusinessObjectService();
53 boService.save(completeness);
54 OleCompleteness completenessService = boService.findBySinglePrimaryKey(OleCompleteness.class,completeness.getCompletenessId());
55 assertEquals("testCode",completenessService.getCompletenessCode());
56 assertEquals("testName",completenessService.getCompletenessName());
57 }
58
59 }