View Javadoc
1   /**
2    * Copyright 2011-2014 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
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   * @author Kuali Mobility Team (mobility.dev@kuali.org)
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  }