View Javadoc

1   package org.kuali.ole.select.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  import static junit.framework.Assert.assertNotNull;
14  
15  /**
16   * Created with IntelliJ IDEA.
17   * User: ?
18   * Date: 12/24/12
19   * Time: 2:46 PM
20   * To change this template use File | Settings | File Templates.
21   */
22  
23  
24  @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
25  @RunWith(value = SpringJUnit4ClassRunner.class)
26  @TransactionConfiguration(defaultRollback = true)
27  
28  public class OleCallNumber_UT {
29      private BusinessObjectService boService ;
30  
31      @Test
32      @Transactional
33      public void testSave() {
34          OleCallNumber oleCallNumber = new OleCallNumber();
35          oleCallNumber.setProfileId("Mock Profile Id");
36          oleCallNumber.setCallNumberPreferenceOne("Mock Call Number Preference One");
37          oleCallNumber.setCallNumberPreferenceTwo("Mock Call Number Preference Two");
38          oleCallNumber.setCallNumberPreferenceThree("Mock Call Number Preference Three");
39          oleCallNumber.setActive(true);
40          boService = KRADServiceLocator.getBusinessObjectService();
41          OleCallNumber savedOleCallNumber = boService.save(oleCallNumber);
42          assertNotNull(savedOleCallNumber);
43          assertNotNull(savedOleCallNumber.getInputValue());
44      }
45  
46  
47      @Test
48      @Transactional
49      public void testSearch() {
50          OleCallNumber oleCallNumber = new OleCallNumber();
51          oleCallNumber.setProfileId("Mock Profile Id");
52          oleCallNumber.setCallNumberPreferenceOne("Mock Call Number Preference One");
53          oleCallNumber.setCallNumberPreferenceTwo("Mock Call Number Preference Two");
54          oleCallNumber.setCallNumberPreferenceThree("Mock Call Number Preference Three");
55          oleCallNumber.setActive(true);
56          boService = KRADServiceLocator.getBusinessObjectService();
57          OleCallNumber savedOleCallNumber = boService.save(oleCallNumber);
58          assertNotNull(savedOleCallNumber);
59          OleCallNumber callNumber = boService.findBySinglePrimaryKey(OleCallNumber.class,savedOleCallNumber.getInputValue());
60          assertEquals("Mock Profile Id", callNumber.getProfileId());
61          assertEquals("Mock Call Number Preference One",callNumber.getCallNumberPreferenceOne());
62          assertEquals("Mock Call Number Preference Two", callNumber.getCallNumberPreferenceTwo());
63          assertEquals("Mock Call Number Preference Three", callNumber.getCallNumberPreferenceThree());
64          assertEquals(true, callNumber.isActive());
65      }
66  }