### Question:
JenkinsClient { public JenkinsClient setCredentials(String user, String password) { checkArgumentNotNull(user, "User cannot be null"); checkArgumentNotNull(password, "Password cannot be null"); getClientHttpRequestFactory().setCredentials(user, password); return this; } 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:
@Test(expected = IllegalArgumentException.class) public void setCredentials_WithNullUser_ThrowsException() throws Exception { client.setCredentials(null, "passw0rd"); }
@Test(expected = IllegalArgumentException.class) public void setCredentials_WithNullPassword_ThrowsException() throws Exception { client.setCredentials("dpacak", null); }
@Test public void setCredentials() throws Exception { client.setCredentials("dpacak", "passw0rd"); verify(httpRequestFactory).setCredentials("dpacak", "passw0rd"); }