BeanNameMappingStrategy implements EndpointAdapterMappingStrategy { @Override public EndpointAdapter getEndpointAdapter(String mappingKey) { try { return referenceResolver.resolve(mappingKey, EndpointAdapter.class); } catch (NoSuchBeanDefinitionException e) { throw new CitrusRuntimeException("Unable to find matching endpoint adapter with bean name '" + mappingKey + "' in Spring bean application context", e); } } BeanNameMappingStrategy(ReferenceResolver referenceResolver); @Override EndpointAdapter getEndpointAdapter(String mappingKey);  }
@Test public void testGetEndpointAdapter() { BeanNameMappingStrategy mappingStrategy = new BeanNameMappingStrategy(referenceResolver); referenceResolver.bind("foo", fooEndpointAdapter); referenceResolver.bind("bar", barEndpointAdapter); 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.assertEquals(e.getMessage(), "Unable to find bean reference for name 'unknown'"); } }