1 package org.kuali.ole.catalog.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 java.sql.Timestamp;
13
14 import static junit.framework.Assert.assertEquals;
15
16
17
18
19
20
21
22
23
24 @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
25 @RunWith(value = SpringJUnit4ClassRunner.class)
26 @TransactionConfiguration(defaultRollback = true)
27 public class OleCountryCodes_UT {
28 private BusinessObjectService boService ;
29 @Test
30 @Transactional
31 public void testSave() {
32 OleCountryCodes oleCountryCodes = new OleCountryCodes();
33 oleCountryCodes.setCountryCode("mockCde");
34 oleCountryCodes.setCountryName("mockCountryName");
35 oleCountryCodes.setCountryRegionName("mockCountryRegionName");
36 oleCountryCodes.setCountryNameSequence("mockCountryNameSequence");
37 oleCountryCodes.setSource("mockSource");
38 Timestamp st = new Timestamp(System.currentTimeMillis());
39 oleCountryCodes.setSourceDate(new java.sql.Date(st.getTime()));
40 oleCountryCodes.setActive(true);
41 boService = KRADServiceLocator.getBusinessObjectService();
42 boService.save(oleCountryCodes);
43 OleCountryCodes oleCountryCodesService = boService.findBySinglePrimaryKey(OleCountryCodes.class,oleCountryCodes.getCountryCodeId());
44 assertEquals("mockCde",oleCountryCodesService.getCountryCode());
45 assertEquals("mockCountryName",oleCountryCodesService.getCountryName());
46 assertEquals("mockCountryRegionName",oleCountryCodesService.getCountryRegionName());
47 assertEquals("mockCountryNameSequence",oleCountryCodesService.getCountryNameSequence());
48 }
49
50 @Test
51 @Transactional
52 public void testSearch(){
53 OleCountryCodes oleCountryCodes = new OleCountryCodes();
54 oleCountryCodes.setCountryCode("mockCde0");
55 oleCountryCodes.setCountryName("mockCountryName0");
56 oleCountryCodes.setCountryRegionName("mockCountryRegionName0");
57 oleCountryCodes.setCountryNameSequence("mockCountryNameSequence0");
58 oleCountryCodes.setSource("mockSource0");
59 Timestamp st = new Timestamp(System.currentTimeMillis());
60 oleCountryCodes.setSourceDate(new java.sql.Date(st.getTime()));
61 oleCountryCodes.setActive(true);
62 boService = KRADServiceLocator.getBusinessObjectService();
63 boService.save(oleCountryCodes);
64 OleCountryCodes oleCountryCodesService = boService.findBySinglePrimaryKey(OleCountryCodes.class,oleCountryCodes.getCountryCodeId());
65 assertEquals("mockCde0",oleCountryCodesService.getCountryCode());
66 assertEquals("mockCountryName0",oleCountryCodesService.getCountryName());
67 assertEquals("mockCountryRegionName0",oleCountryCodesService.getCountryRegionName());
68 assertEquals("mockCountryNameSequence0",oleCountryCodesService.getCountryNameSequence());
69 }
70 }