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