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 java.sql.Timestamp;
13  
14  import static junit.framework.Assert.assertEquals;
15  
16  /**
17   * Created by IntelliJ IDEA.
18   * User: meenau
19   * Date: 6/4/12
20   * Time: 6:05 PM
21   * To change this template use File | Settings | File Templates.
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  }