RestUtils { public static String getExpandedPath(String path, RestParamsPropertyHolder params, ModelItem context) { String expandedPath = path; expandedPath = PropertyExpander.expandProperties(context, expandedPath); for (String pathParam : RestUtils.extractTemplateParams(expandedPath)) { String pathParamValue = params.getPropertyValue(pathParam); pathParamValue = PropertyExpander.expandProperties(context, pathParamValue); expandedPath = expandedPath.replaceAll("\\{" + pathParam + "\\}", pathParamValue == null ? "" : pathParamValue); } return expandedPath; }  static String[] extractTemplateParams(String path); static String extractParams(String pathOrEndpoint, RestParamsPropertyHolder params, boolean keepHost); static String extractParams(String pathOrEndpoint, RestParamsPropertyHolder params, boolean keepHost, TemplateExtractionOption templateExtractionOptions); static void extractParamsFromQueryString(RestParamsPropertyHolder params, String queryString); static String expandPath(String path, RestParamsPropertyHolder params, RestRequestInterface request); static String makeSuffixParameterString(RestRequestInterface request); static String getQueryParamsString(RestRequestInterface request); static List<String> splitMultipleParameters(String paramStr, String delimiter); static List<String> splitMultipleParametersEmptyIncluded(String paramStr, String delimiter); static List<RestResource> extractAncestorsParentFirst(RestResource childResource); static String getExpandedPath(String path, RestParamsPropertyHolder params, ModelItem context);  }
@Test public void expandsPathWithPropertyExpansionOnPathAndTemplateParameter() throws Exception { RestRequest restRequest = makeRestRequest(); restRequest.getProject().setPropertyValue("version", "xml"); String templateParameterName = "templateName"; String templateParameterValue = "templateValue"; restRequest.getResource().setPath("/the/{" + templateParameterName + "}/path/${#Project#version}"); addParameter(restRequest, TEMPLATE, templateParameterName, templateParameterValue); assertThat(RestUtils.getExpandedPath(restRequest.getResource().getFullPath(), restRequest.getParams(), restRequest), is("/the/" + templateParameterValue + "/path/xml")); }