SimpleMappingStrategy implements EndpointAdapterMappingStrategy { @Override public EndpointAdapter getEndpointAdapter(String mappingKey) { if (adapterMappings.containsKey(mappingKey)) { return adapterMappings.get(mappingKey); } else { throw new CitrusRuntimeException("Unable to find matching endpoint adapter with mapping key '" + mappingKey + "'"); } }  @Override EndpointAdapter getEndpointAdapter(String mappingKey); void setAdapterMappings(Map<String, EndpointAdapter> mappings);  }
@Test public void testGetEndpointAdapter() throws Exception { SimpleMappingStrategy mappingStrategy = new SimpleMappingStrategy(); Map<String, EndpointAdapter> mappings = new HashMap<String, EndpointAdapter>(); mappings.put("foo", fooEndpointAdapter); mappings.put("bar", barEndpointAdapter); mappingStrategy.setAdapterMappings(mappings); Assert.assertEquals(mappingStrategy.getEndpointAdapter("foo"), fooEndpointAdapter); Assert.assertEquals(mappingStrategy.getEndpointAdapter("bar"), barEndpointAdapter); try { mappingStrategy.getEndpointAdapter("unknown"); Assert.fail("Missing exception due to unknown mapping key"); } catch (CitrusRuntimeException e) { Assert.assertTrue(e.getMessage().startsWith("Unable to find matching endpoint adapter with mapping key 'unknown'")); } }