/** * Sets properties on endpoint configuration using method reflection. * * @param endpointConfiguration * @param parameters * @param context */ protected void enrichEndpointConfiguration( EndpointConfiguration endpointConfiguration, Map<String, String> parameters, TestContext context) { for (Map.Entry<String, String> parameterEntry : parameters.entrySet()) { Field field = ReflectionUtils.findField(endpointConfiguration.getClass(), parameterEntry.getKey()); if (field == null) { throw new CitrusRuntimeException( String.format( "Unable to find parameter field on endpoint configuration '%s'", parameterEntry.getKey())); } Method setter = ReflectionUtils.findMethod( endpointConfiguration.getClass(), "set" + parameterEntry.getKey().substring(0, 1).toUpperCase() + parameterEntry.getKey().substring(1), field.getType()); if (setter == null) { throw new CitrusRuntimeException( String.format( "Unable to find parameter setter on endpoint configuration '%s'", "set" + parameterEntry.getKey().substring(0, 1).toUpperCase() + parameterEntry.getKey().substring(1))); } ReflectionUtils.invokeMethod( setter, endpointConfiguration, TypeConversionUtils.convertStringToType( parameterEntry.getValue(), field.getType(), context)); } }