1 package org.kuali.ole.license.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 java.sql.Timestamp;
13
14 import static junit.framework.Assert.assertEquals;
15
16
17
18
19
20
21
22
23
24 @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
25 @RunWith(value = SpringJUnit4ClassRunner.class)
26 @TransactionConfiguration(defaultRollback = true)
27
28 public class OleLicenseRequestStatus_UT {
29
30 private BusinessObjectService boService ;
31 @Test
32 @Transactional
33 public void testSave() {
34 OleLicenseRequestStatus oleLicenseRequestStatus = new OleLicenseRequestStatus();
35 oleLicenseRequestStatus.setCode("Mock Code");
36 oleLicenseRequestStatus.setName("Mock Name");
37 oleLicenseRequestStatus.setDescription("Mock Description");
38 oleLicenseRequestStatus.setActive(true);
39 boService = KRADServiceLocator.getBusinessObjectService();
40 boService.save(oleLicenseRequestStatus);
41 OleLicenseRequestStatus savedLicenseStatus = boService.findBySinglePrimaryKey(OleLicenseRequestStatus.class,oleLicenseRequestStatus.getCode());
42 assertEquals("Mock Name",savedLicenseStatus.getName());
43 assertEquals("Mock Description",savedLicenseStatus.getDescription());
44 }
45
46 @Test
47 @Transactional
48 public void testSearch(){
49 OleLicenseRequestStatus oleLicenseRequestStatus = new OleLicenseRequestStatus();
50 oleLicenseRequestStatus.setCode("Mock Code");
51 oleLicenseRequestStatus.setName("Mock Name");
52 oleLicenseRequestStatus.setDescription("Mock Description");
53 oleLicenseRequestStatus.setActive(true);
54 boService = KRADServiceLocator.getBusinessObjectService();
55 boService.save(oleLicenseRequestStatus);
56 OleLicenseRequestStatus savedLicenseStatus = boService.findBySinglePrimaryKey(OleLicenseRequestStatus.class,oleLicenseRequestStatus.getCode());
57 assertEquals("Mock Name",savedLicenseStatus.getName());
58 assertEquals("Mock Description",savedLicenseStatus.getDescription());
59 }
60 }