HttpContent implements MultipartContainer { public void addHeader(String key, String value) { Assert.notNull(key, "Header key"); Assert.notNull(value, "Header value"); headers.put(key, value); } HttpContent(String url, HttpMethod method); HttpMethod getMethod(); String getUrl(); void addHeader(String key, String value); String getHeader(String key); Map<String, String> getHeaders(); void setBody(byte[] body); byte[] getBody(); @Override boolean hasMultipart(); @Override Multipart getMultipart(); void addPart(Part part);  }
@Test(expected=NullPointerException.class) public void addHeaderMethodShouldThrowNpeWhenKeyIsNull() { String nullKey = null; String value = "test"; String url = "test"; HttpMethod method = HttpMethod.GET; HttpContent httpContent = new HttpContent(url, method); httpContent.addHeader(nullKey, value); }
@Test(expected=NullPointerException.class) public void addHeaderMethodShouldThrowNpeWhenValueIsNull() { String key = "test"; String nullValue = null; String url = "test"; HttpMethod method = HttpMethod.GET; HttpContent httpContent = new HttpContent(url, method); httpContent.addHeader(key, nullValue); }