View Javadoc

1   package org.kuali.ole.ingest.pojo;
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.util.Arrays;
13  import java.util.Collection;
14  import java.util.HashMap;
15  import java.util.List;
16  
17  import static junit.framework.Assert.assertNotNull;
18  import static junit.framework.Assert.assertTrue;
19  
20  /**
21   * Created by IntelliJ IDEA.
22   * User: pvsubrah
23   * Date: 4/8/12
24   * Time: 9:22 AM
25   * To change this template use File | Settings | File Templates.
26   */
27  @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
28  @RunWith(value = SpringJUnit4ClassRunner.class)
29  @TransactionConfiguration(defaultRollback = true)
30  public class ProfileAttributeBo_UT {
31      
32      @Test
33      @Transactional
34      public void testCreateProfileAttributeBo() throws Exception {
35          BusinessObjectService businessObjectService = KRADServiceLocator.getBusinessObjectService();
36          ProfileAttributeBo profileAttributeBo = new ProfileAttributeBo();
37          profileAttributeBo.setAgendaName("mock_agenda");
38          profileAttributeBo.setAttributeName("mock_attribute");
39          profileAttributeBo.setAttributeValue("mock_value");
40          businessObjectService.save(Arrays.asList(profileAttributeBo));
41  
42          HashMap map = new HashMap();
43          map.put("agenda_name", "mock_agenda");
44          List<ProfileAttributeBo> matching = (List<ProfileAttributeBo>) businessObjectService.findMatching(ProfileAttributeBo.class, map);
45          assertNotNull(matching);
46          assertTrue(!matching.isEmpty());
47      }
48      
49      
50  }