View Javadoc

1   package org.kuali.ole.deliver;
2   
3   import org.junit.Before;
4   import org.junit.Test;
5   import org.junit.runner.RunWith;
6   import org.kuali.ole.patron.LoadDefaultPatronsBean;
7   import org.kuali.ole.patron.bo.OlePatronDocument;
8   import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
9   import org.kuali.rice.krad.service.BusinessObjectService;
10  import org.kuali.rice.krad.service.KRADServiceLocator;
11  import org.springframework.test.context.ContextConfiguration;
12  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
13  import org.springframework.test.context.transaction.TransactionConfiguration;
14  
15  import java.util.Iterator;
16  import java.util.List;
17  
18  import static junit.framework.Assert.assertNotNull;
19  import static junit.framework.Assert.assertTrue;
20  
21  /**
22   * Created with IntelliJ IDEA.
23   * User: peris
24   * Date: 10/31/12
25   * Time: 3:40 PM
26   * To change this template use File | Settings | File Templates.
27   */
28  @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
29  @RunWith(value = SpringJUnit4ClassRunner.class)
30  @TransactionConfiguration(defaultRollback = true)
31  public class LoadDefaultCirculationPoliciesBean_UT {
32      protected LoadDefaultCirculationPoliciesBean loadDefaultCirculationPoliciesBean;
33      private BusinessObjectService businessObjectService;
34  
35      @Before
36      public void setUp() throws Exception {
37          businessObjectService = KRADServiceLocator.getBusinessObjectService();
38          loadDefaultCirculationPoliciesBean = GlobalResourceLoader.getService("loadDefaultCirculationPoliciesBean");
39      }
40  
41      @Test
42      public void loadDefaultLocations() throws Exception {
43          List<String> policies = loadDefaultCirculationPoliciesBean.loadDefaultCircPolicies();
44          assertNotNull(policies);
45          assertTrue(!policies.isEmpty());
46          for (Iterator<String> iterator = policies.iterator(); iterator.hasNext(); ) {
47              String policy = iterator.next();
48              System.out.println(policy);
49          }
50      }
51  }