### Question:
JenkinsClient { public <T> T getForObject(String uri, Class<T> responseType) { ResponseExtractor<T> responseExtractor = new HttpMessageConverterResponseExtractor<T>(responseType, messageConverters); return execute(newURI(baseUri + uri), HttpMethod.GET, null, responseExtractor); } 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 getForObject() throws Exception { given(converter.canRead(String.class)).willReturn(true); given(httpRequestFactory.createRequest(new URI("http: given(httpRequest.getHeaders()).willReturn(new HttpHeaders()); given(httpRequest.execute()).willReturn(httpResponse); given(errorHandler.hasError(httpResponse)).willReturn(false); given(httpResponse.getStatusCode()).willReturn(HttpStatus.OK); given(httpResponse.getHeaders()).willReturn(new HttpHeaders()); given(converter.read(String.class, httpResponse)).willReturn("Hello, Jenkins!"); assertEquals("Hello, Jenkins!", client.getForObject("/api/xml", String.class)); verify(httpResponse).close(); }