### Question:
RestClient { String buildUrl(String callerSuppliedFullUrlOrRelativePath) { String url = callerSuppliedFullUrlOrRelativePath; if (url != null && (url.startsWith("http: } else { url = url != null ? url : ""; String prefix = Config.getString(getName() + ".url", this.url); if (!Utils.empty(prefix)) { if (url.length() > 0 && !url.startsWith("/") && !prefix.endsWith("/")) url = prefix + "/" + url; else url = prefix + url; } } if (Chain.peek() != null && url.indexOf('$') > 0) { Request request = Chain.top().getRequest(); StringBuffer buff = new StringBuffer(); Pattern p = Pattern.compile("\\$\\{([^\\}]*)\\}"); Matcher m = p.matcher(url); while (m.find()) { String key = m.group(1); String param = request.getUrl().getParam(key); if (param == null) param = "${" + key + "}"; String value = Matcher.quoteReplacement(param); m.appendReplacement(buff, value); } m.appendTail(buff); return buff.toString(); } return url; } RestClient();  RestClient(String name); FutureResponse get(String fullUrlOrRelativePath); FutureResponse get(String fullUrlOrRelativePath, String queryString); FutureResponse get(String fullUrlOrRelativePath, Map<String, String> params); FutureResponse get(String fullUrlOrRelativePath, String... queryStringNameValuePairs); FutureResponse post(String fullUrlOrRelativePath, JSNode body); FutureResponse put(String fullUrlOrRelativePath, JSNode body); FutureResponse patch(String fullUrlOrRelativePath, JSNode body); FutureResponse delete(String fullUrlOrRelativePath); FutureResponse call(String method, String fullUrlOrRelativePath, Map<String, String> params, JSNode body, int retryMax, ArrayListValuedHashMap<String, String> headers); RestClient withUrl(String url); ArrayListValuedHashMap<String, String> getForcedHeaders(); RestClient withForcedHeader(String name, String value); RestClient withForcedHeaders(String... headers); RestClient withForwardedHeaders(boolean forwardHeaders); RestClient withForwardedParams(boolean forwardParams); String getName(); RestClient withName(String name); boolean isUseCompression(); RestClient withUseCompression(boolean useCompression); int getCompressionMinSize(); RestClient withCompressionMinSize(int compressionMinSize); int getRetryMax(); RestClient withRetryMax(int retryMax); int getSocketTimeout(); RestClient withSocketTimeout(int socketTimeout); int getConnectTimeout(); RestClient withConnectTimeout(int connectTimeout); int getRequestTimeout(); RestClient withRequestTimeout(int requestTimeout); RestClient withHttpClient(HttpClient httpClient); Executor getExecutor(); RestClient withExecutor(Executor executor); boolean isForwardHeaders(); RestClient withForwardHeaders(boolean forwardHeaders); Set<String> getIncludeForwardHeaders(); RestClient withIncludeForwardHeaders(String... headerKeys); RestClient removeIncludeForwardHeader(String headerKey); Set getExcludeForwardHeaders(); RestClient withExcludeForwardHeaders(String... headerKeys); RestClient removeExcludeForwardHeader(String headerKey); boolean isForwardParams(); RestClient withForwardParams(boolean forwardParams); Set getWhitelistParams(); RestClient withWhitelistedParams(String... paramNames); RestClient removeWhitelistParam(String param); int getRetryTimeoutMin(); RestClient withRetryTimeoutMin(int retryTimeoutMin); int getRetryTimeoutMax(); RestClient getRetryTimeoutMax(int retryTimeoutMax);  }### Answer:
@Test public void buildUrl_variable_replaced() { System.setProperty("theirService.url", "http: Request req = new Request("GET", "http: RestClient client = new RestClient("theirService"); try { Chain.push(null, req, null); String url = client.buildUrl(null); assertEquals("http: } finally { Chain.pop(); } }