View Javadoc

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 static junit.framework.Assert.assertEquals;
13  
14  /**
15   * Created by IntelliJ IDEA.
16   * User: meenau
17   * Date: 6/4/12
18   * Time: 6:05 PM
19   * To change this template use File | Settings | File Templates.
20   */
21  
22  @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
23  @RunWith(value = SpringJUnit4ClassRunner.class)
24  @TransactionConfiguration(defaultRollback = true)
25  
26  public class OleLicenseRequestStatus_UT {
27  
28      private BusinessObjectService boService ;
29      @Test
30      @Transactional
31      public void testSave() {
32          OleLicenseRequestStatus oleLicenseRequestStatus = new OleLicenseRequestStatus();
33          oleLicenseRequestStatus.setCode("Mock Code");
34          oleLicenseRequestStatus.setName("Mock Name");
35          oleLicenseRequestStatus.setDescription("Mock Description");
36          oleLicenseRequestStatus.setActive(true);
37          boService = KRADServiceLocator.getBusinessObjectService();
38          boService.save(oleLicenseRequestStatus);
39          OleLicenseRequestStatus savedLicenseStatus = boService.findBySinglePrimaryKey(OleLicenseRequestStatus.class,oleLicenseRequestStatus.getCode());
40          assertEquals("Mock Name",savedLicenseStatus.getName());
41          assertEquals("Mock Description",savedLicenseStatus.getDescription());
42      }
43  
44      @Test
45      @Transactional
46      public void testSearch(){
47          OleLicenseRequestStatus oleLicenseRequestStatus = new OleLicenseRequestStatus();
48          oleLicenseRequestStatus.setCode("Mock Code");
49          oleLicenseRequestStatus.setName("Mock Name");
50          oleLicenseRequestStatus.setDescription("Mock Description");
51          oleLicenseRequestStatus.setActive(true);
52          boService = KRADServiceLocator.getBusinessObjectService();
53          boService.save(oleLicenseRequestStatus);
54          OleLicenseRequestStatus savedLicenseStatus = boService.findBySinglePrimaryKey(OleLicenseRequestStatus.class,oleLicenseRequestStatus.getCode());
55          assertEquals("Mock Name",savedLicenseStatus.getName());
56          assertEquals("Mock Description",savedLicenseStatus.getDescription());
57      }
58  }