HttpCall { public HttpCall setHeader(String key, String value) { requireNonNull(key, "Header key cannot be null"); requireNonNull(value, "Header [" + key + "] cannot have null value"); headers.put(key, value); return this; } HttpCall(OkHttpClient okClient, HttpUrl baseUrl); HttpUrl getBaseUrl(); HttpCall setMethod(HttpMethod m); HttpCall setCredentials(String login, @Nullable String password); HttpCall setAdminCredentials(); HttpCall setAuthenticationToken(String token); HttpCall setParam(String key, @Nullable String value); HttpCall setParams(String key1, @Nullable String value1, String... otherKeysAndNames); HttpCall setHeader(String key, String value); HttpCall setTimeoutMs(long timeoutMs); HttpResponse execute(); HttpResponse executeUnsafely(); void downloadToFile(File file); File downloadToDirectory(File dir);  }
@Test public void setHeader_throws_NPE_if_key_is_null() { expectedException.expect(NullPointerException.class); expectedException.expectMessage("Header key cannot be null"); newCall("").setHeader(null, "foo"); }
@Test public void setHeader_throws_NPE_if_value_is_null() { expectedException.expect(NullPointerException.class); expectedException.expectMessage("Header [foo] cannot have null value"); newCall("").setHeader("foo", null); }