### Question:
JenkinsClient { public URI postForLocation(String uri, Object request) { RequestCallback requestCallback = new HttpMessageCoverterRequestCallback(request, messageConverters); HttpHeadersResponseExtractor responseExtractor = new HttpHeadersResponseExtractor(); return execute(newURI(baseUri + uri), HttpMethod.POST, requestCallback, responseExtractor).getLocation(); } JenkinsClient();  JenkinsClient(String host, Integer port);  JenkinsClient(String scheme, String host, Integer port, String prefix); T getForObject(String uri, Class<T> responseType); URI postForLocation(String uri, Object request); T postForObject(String uri, Object request, Class<T> responseType); JenkinsClient setCredentials(String user, String password); JenkinsClient setUserAgent(String identifier); ClientHttpRequestFactory getClientHttpRequestFactory(); void setClientHttpRequestFactory(ClientHttpRequestFactory clientHttpRequestFactory); ResponseErrorHandler getResponseErrorHandler(); JenkinsClient setResponseErrorHandler(ResponseErrorHandler responseErrorHandler); List<HttpMessageConverter<?>> getMessageConverters(); void setMessageConverters(List<HttpMessageConverter<?>> messageConverters); static final String DEFAULT_URL_HOST; static final int DEFAULT_URL_PORT; static final String SEGMENT_JOB; static final String SEGMENT_CREATE_ITEM; static final String SEGMENT_DO_DELETE; static final String SEGMENT_API_XML; static final String SEGMENT_CONFIG_XML; static final String SEGMENT_SCRIPT_TEXT; static final String DEFAULT_USER_AGENT; }### Answer:
@SuppressWarnings("unchecked") @Test public void postForLocation() throws Exception { given(converter.canWrite(String.class)).willReturn(true); given(errorHandler.hasError(httpResponse)).willReturn(false); given(httpRequestFactory.createRequest(new URI("http: given(httpRequest.execute()).willReturn(httpResponse); HttpHeaders responseHeaders = new HttpHeaders().setLocation(new URI("http: given(httpResponse.getHeaders()).willReturn(responseHeaders); assertEquals(new URI("http: verify(converter).write("Post payload", null, httpRequest); verify(httpResponse).close(); }