1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.kuali.mobility.maps.service;
16
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19 import org.junit.Before;
20 import org.junit.Test;
21 import org.junit.runner.RunWith;
22 import org.kuali.mobility.maps.entity.Location;
23 import org.kuali.mobility.maps.entity.MapsGroup;
24 import org.springframework.test.context.ContextConfiguration;
25 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
26
27 import javax.annotation.Resource;
28
29 import static org.junit.Assert.assertTrue;
30
31
32
33
34 @RunWith(SpringJUnit4ClassRunner.class)
35 @ContextConfiguration(value = "classpath:KMESpringBeans.xml")
36 public class MapsServiceImplTest {
37 private static final Logger LOG = LoggerFactory.getLogger(MapsServiceImplTest.class);
38
39 @Resource(name="mapsService")
40 private MapsService service;
41
42 @Before
43 public void setUpClass() throws Exception {
44 }
45
46 @Test
47 public void testGetMapsGroupById() {
48 MapsGroup mapGroup = getService().getMapsGroupById("ZZZZ");
49 assertTrue("Should not find a map group with ID ZZZZ", mapGroup == null);
50 mapGroup = getService().getMapsGroupById("UA");
51 assertTrue("Should find a map group with ID UA", mapGroup != null);
52 }
53
54 @Test
55 public void testGetLocationById() {
56 Location location = getService().getLocationById("ZZZZ");
57 assertTrue("Should not find a location with ID ZZZZ", location == null);
58 location = getService().getLocationById("SB");
59 assertTrue("Should find a location with ID SB", location != null);
60 }
61
62 public MapsService getService() {
63 return service;
64 }
65
66 public void setService(MapsService service) {
67 this.service = service;
68 }
69 }