View Javadoc

1   /**
2    * Created with IntelliJ IDEA.
3    * User: ?
4    * Date: 5/29/12
5    * Time: 12:29 PM
6    * To change this template use File | Settings | File Templates.
7    */
8   package org.kuali.ole.catalog.bo;
9   
10  
11  import org.junit.Test;
12  import org.junit.runner.RunWith;
13  
14  import org.kuali.rice.krad.service.BusinessObjectService;
15  import org.kuali.rice.krad.service.KRADServiceLocator;
16  import org.springframework.test.context.ContextConfiguration;
17  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
18  import org.springframework.test.context.transaction.TransactionConfiguration;
19  import org.springframework.transaction.annotation.Transactional;
20  import java.sql.Timestamp;
21  import static junit.framework.Assert.assertEquals;
22  
23  
24  @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
25  @RunWith(value = SpringJUnit4ClassRunner.class)
26  @TransactionConfiguration(defaultRollback = true)
27  
28  public class OleLocationStatus_UT {
29  
30      private BusinessObjectService boService ;
31      @Test
32      @Transactional
33      public void testSave() {
34          OleLocationStatus oleLocationStatus = new OleLocationStatus();
35          oleLocationStatus.setLocationStatusCode("mockCd");
36          oleLocationStatus.setLocationStatusName("mockLocationStatusName");
37          oleLocationStatus.setSource("mockSource");
38          Timestamp st = new Timestamp(System.currentTimeMillis());
39          oleLocationStatus.setSourceDate(new java.sql.Date(st.getTime()));
40          oleLocationStatus.setActive(true);
41          boService = KRADServiceLocator.getBusinessObjectService();
42          boService.save(oleLocationStatus);
43          OleLocationStatus oleLocationStatusService = boService.findBySinglePrimaryKey(OleLocationStatus.class,oleLocationStatus.getLocationStatusId());
44          assertEquals("mockCd",oleLocationStatusService.getLocationStatusCode());
45          assertEquals("mockLocationStatusName",oleLocationStatusService.getLocationStatusName());
46      }
47  
48      @Test
49      @Transactional
50      public void testSearch(){
51          OleLocationStatus oleLocationStatus = new OleLocationStatus();
52          oleLocationStatus.setLocationStatusCode("mockCd");
53          oleLocationStatus.setLocationStatusName("mockLocationStatusName");
54          oleLocationStatus.setSource("mockSource");
55          Timestamp st = new Timestamp(System.currentTimeMillis());
56          oleLocationStatus.setSourceDate(new java.sql.Date(st.getTime()));
57          oleLocationStatus.setActive(true);
58          boService = KRADServiceLocator.getBusinessObjectService();
59          boService.save(oleLocationStatus);
60          OleLocationStatus oleLocationStatusService = boService.findBySinglePrimaryKey(OleLocationStatus.class,oleLocationStatus.getLocationStatusId());
61          assertEquals("mockCd",oleLocationStatusService.getLocationStatusCode());
62          assertEquals("mockLocationStatusName",oleLocationStatusService.getLocationStatusName());
63      }
64  }