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 OleGeneralRetentionPolicy_UT {
26 private BusinessObjectService boService;
27 @Test
28 @Transactional
29 public void testSave() {
30 OleGeneralRetentionPolicy generalRetentionPolicy = new OleGeneralRetentionPolicy();
31 generalRetentionPolicy.setGeneralRetentionPolicyId(1);
32 generalRetentionPolicy.setGeneralRetentionPolicyCode("testCode");
33 generalRetentionPolicy.setGeneralRetentionPolicyName("testName");
34 generalRetentionPolicy.setSource("testSource");
35 generalRetentionPolicy.setActive(true);
36 boService = KRADServiceLocator.getBusinessObjectService();
37 boService.save(generalRetentionPolicy);
38 OleGeneralRetentionPolicy generalRetentionPolicyService = boService.findBySinglePrimaryKey(OleGeneralRetentionPolicy.class,generalRetentionPolicy.getGeneralRetentionPolicyId());
39 assertEquals("testCode",generalRetentionPolicyService.getGeneralRetentionPolicyCode());
40 assertEquals("testName",generalRetentionPolicyService.getGeneralRetentionPolicyName());
41 }
42
43 @Test
44 @Transactional
45 public void testSearch(){
46 OleGeneralRetentionPolicy generalRetentionPolicy = new OleGeneralRetentionPolicy();
47 generalRetentionPolicy.setGeneralRetentionPolicyId(1);
48 generalRetentionPolicy.setGeneralRetentionPolicyCode("testCode");
49 generalRetentionPolicy.setGeneralRetentionPolicyName("testName");
50 generalRetentionPolicy.setSource("testSource");
51 generalRetentionPolicy.setActive(true);
52 boService = KRADServiceLocator.getBusinessObjectService();
53 boService.save(generalRetentionPolicy);
54 OleGeneralRetentionPolicy generalRetentionPolicyService = boService.findBySinglePrimaryKey(OleGeneralRetentionPolicy.class,generalRetentionPolicy.getGeneralRetentionPolicyId());
55 assertEquals("testCode",generalRetentionPolicyService.getGeneralRetentionPolicyCode());
56 assertEquals("testName",generalRetentionPolicyService.getGeneralRetentionPolicyName());
57 }
58
59 }