1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.travel.dataobject;
17
18 import org.junit.Test;
19 import org.kuali.rice.krad.service.KRADServiceLocator;
20 import org.kuali.rice.krad.test.KRADTestCase;
21 import org.kuali.rice.test.BaselineTestCase;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25 import static org.junit.Assert.assertTrue;
26
27
28
29
30
31
32 @BaselineTestCase.BaselineMode(BaselineTestCase.Mode.ROLLBACK_CLEAR_DB)
33 public class TravelCompanyTest extends KRADTestCase {
34
35 private static final String COMPANY_NAME = "Get Away! Travel";
36
37
38
39
40 @Test
41 public void testTravelCompany() {
42 assertTrue(TravelCompany.class.getName() + " is not mapped in JPA",
43 KRADServiceLocator.getDataObjectService().supports(TravelCompany.class));
44
45 String id = createTravelCompany();
46
47 TravelCompany travelCompany = KRADServiceLocator.getDataObjectService().find(TravelCompany.class, id);
48 assertNotNull("Travel Company ID is null", travelCompany.getTravelCompanyId());
49 assertEquals("Travel Company name is incorrect", COMPANY_NAME, travelCompany.getTravelCompanyName());
50 assertTrue("Travel Company is not active", travelCompany.isActive());
51 }
52
53 private String createTravelCompany() {
54 TravelCompany travelCompany = new TravelCompany();
55 travelCompany.setTravelCompanyName(COMPANY_NAME);
56 travelCompany.setActive(true);
57
58 return KRADServiceLocator.getDataObjectService().save(travelCompany).getTravelCompanyId();
59 }
60 }