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
17
18
19
20
21
22
23 @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
24 @RunWith(value = SpringJUnit4ClassRunner.class)
25 @TransactionConfiguration(defaultRollback = true)
26
27 public class OleVendorAccountInfo_UT {
28
29 private BusinessObjectService boService ;
30
31 @Test
32 @Transactional
33 public void testSave() {
34 OleVendorAccountInfo oleVendorAccountInfo = new OleVendorAccountInfo();
35 oleVendorAccountInfo.setVendorRefNumber("Mock Vendor Identifier");
36 oleVendorAccountInfo.setAccountNumber("Mock Account Number");
37 oleVendorAccountInfo.setObjectCode("Mock Object Code");
38 oleVendorAccountInfo.setActive(true);
39 boService = KRADServiceLocator.getBusinessObjectService();
40 OleVendorAccountInfo savedOleVendorAccountInfo = boService.save(oleVendorAccountInfo);
41 assertNotNull(savedOleVendorAccountInfo);
42 assertNotNull(savedOleVendorAccountInfo.getVendorAccountInfoId());
43 }
44
45
46 @Test
47 @Transactional
48 public void testSearch() {
49 OleVendorAccountInfo oleVendorAccountInfo = new OleVendorAccountInfo();
50 oleVendorAccountInfo.setVendorRefNumber("Mock Vendor Identifier");
51 oleVendorAccountInfo.setAccountNumber("Mock Account Number");
52 oleVendorAccountInfo.setObjectCode("Mock Object Code");
53 oleVendorAccountInfo.setActive(true);
54 boService = KRADServiceLocator.getBusinessObjectService();
55 OleVendorAccountInfo savedOleVendorAccountInfo = boService.save(oleVendorAccountInfo);
56 assertNotNull(savedOleVendorAccountInfo);
57 OleVendorAccountInfo vendorAccountInfo = boService.findBySinglePrimaryKey(OleVendorAccountInfo.class,savedOleVendorAccountInfo.getVendorAccountInfoId());
58 assertEquals("Mock Vendor Identifier", vendorAccountInfo.getVendorRefNumber());
59 assertEquals("Mock Account Number",vendorAccountInfo.getAccountNumber());
60 assertEquals("Mock Object Code", vendorAccountInfo.getObjectCode());
61 assertEquals(true, vendorAccountInfo.isActive());
62 }
63
64
65 }
66