1 package org.kuali.mobility.bus.dao.helper;
2
3 import static org.junit.Assert.*;
4
5 import java.util.List;
6 import org.apache.log4j.Logger;
7 import org.junit.AfterClass;
8 import org.junit.BeforeClass;
9
10 import org.junit.Test;
11 import org.springframework.context.ApplicationContext;
12 import org.springframework.context.support.FileSystemXmlApplicationContext;
13
14
15 public class BusStopNameUtilTest
16 {
17 private static final Logger LOG = Logger.getLogger(BusStopNameUtilTest.class);
18
19 private static ApplicationContext applicationContext;
20
21 @BeforeClass
22 public static void setUpClass() throws Exception {
23 BusStopNameUtilTest.setApplicationContext(new FileSystemXmlApplicationContext(getConfigLocations()));
24 }
25
26 private static String[] getConfigLocations() {
27 return new String[] { "classpath:/BusSpringBeans.xml" };
28 }
29
30 @AfterClass
31 public static void tearDownClass() throws Exception {
32 }
33
34 @Test
35 public void testloadStopNames() {
36 BusStopNameUtil busStopNameMapper = (BusStopNameUtil)getApplicationContext().getBean("busStopNameMapper");
37
38 List<UMBusStopName> busStopNames = busStopNameMapper.getBusStopNames();
39 assertTrue( "Failed to find nearby bus stops.", busStopNames != null );
40 }
41
42 @Test
43 public void testupdateBusStopName() {
44 BusStopNameUtil busStopNameMapper = (BusStopNameUtil)getApplicationContext().getBean("busStopNameMapper");
45
46 String me = busStopNameMapper.updateBusStopName("Biomedical Science Research");
47 assertTrue( "Failed to find nearby bus stops.", me != null );
48 String me1 = busStopNameMapper.updateBusStopName("Zina Pitcher Place (at BSR)");
49 assertTrue( "Failed to find nearby bus stops.", me1 != null );
50
51 }
52
53
54
55
56 public static ApplicationContext getApplicationContext() {
57 return applicationContext;
58 }
59
60
61
62
63 public static void setApplicationContext(ApplicationContext aApplicationContext) {
64 applicationContext = aApplicationContext;
65 }
66 }