View Javadoc
1   /*
2    * Copyright 2018 the original author or authors.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *         http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  package org.openehealth.ipf.commons.spring.map.config;
17  
18  import static org.junit.Assert.assertEquals;
19  
20  import org.junit.Test;
21  import org.junit.runner.RunWith;
22  import org.springframework.beans.factory.annotation.Autowired;
23  import org.springframework.test.context.ContextConfiguration;
24  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
25  
26  @RunWith(SpringJUnit4ClassRunner.class)
27  @ContextConfiguration(locations = { "/context-custom-configurer.xml",
28  		"/context-custom-mappings.xml" })
29  public class CustomMappingsConfigurerTest {
30  
31      @Autowired
32      private CustomMappingsConfigurer<?> configurer;
33      
34      @Test
35      public void testMappings() {
36          assertEquals("b1", configurer.getMappingService().get("m1", "a1"));
37          assertEquals("b2", configurer.getMappingService().get("m2", "a2"));
38          assertEquals("b3", configurer.getMappingService().get("m3", "a3"));
39          
40          assertEquals("c1", configurer.getMappingService().get("m4", "d1"));
41          assertEquals("c2", configurer.getMappingService().get("m5", "d2"));
42          assertEquals("c3", configurer.getMappingService().get("m6", "d3"));
43      }
44  	
45  }