### Question:
HttpRequest { public String getHeader(String name) { List<String> headerList = getHeaders(name); if (headerList.isEmpty()) { return null; } else { return headerList.get(0); } } HttpRequest(Uri uri);  HttpRequest(HttpRequest request); HttpRequest setMethod(String method); HttpRequest setUri(Uri uri); HttpRequest addHeader(String name, String value); HttpRequest setHeader(String name, String value); HttpRequest addHeaders(Map<String, String> headers); HttpRequest addAllHeaders(Map<String, ? extends List<String>> headers); List<String> removeHeader(String name); HttpRequest setPostBody(byte[] postBody); HttpRequest setPostBody(InputStream is); HttpRequest setIgnoreCache(boolean ignoreCache); boolean isSanitizationRequested(); void setSanitizationRequested(boolean sanitizationRequested); boolean isCajaRequested(); void setCajaRequested(boolean cajaRequested); HttpRequest setCacheTtl(int cacheTtl); HttpRequest setGadget(Uri gadget); HttpRequest setContainer(String container); HttpRequest setSecurityToken(SecurityToken securityToken); HttpRequest setOAuthArguments(OAuthArguments oauthArguments); HttpRequest setOAuth2Arguments(OAuth2Arguments oauth2Arguments); HttpRequest setFollowRedirects(boolean followRedirects); HttpRequest setAuthType(AuthType authType); HttpRequest setRewriteMimeType(String rewriteMimeType); String getMethod(); Uri getUri(); Map<String, List<String>> getHeaders(); List<String> getHeaders(String name); String getHeader(String name); String getContentType(); InputStream getPostBody(); String getPostBodyAsString(); int getPostBodyLength(); boolean getIgnoreCache(); int getCacheTtl(); Uri getGadget(); String getParam(String paramName); Integer getParamAsInteger(String paramName); void setParam(String paramName, T paramValue); Map<String, String> getParams(); String getContainer(); SecurityToken getSecurityToken(); OAuthArguments getOAuthArguments(); OAuth2Arguments getOAuth2Arguments(); boolean getFollowRedirects(); AuthType getAuthType(); String getRewriteMimeType(); boolean isInternalRequest(); HttpRequest setInternalRequest(boolean internalRequest); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static final String DOS_PREVENTION_HEADER; }### Answer:
@Test public void dosPreventionHeaderAdded() { HttpRequest request = new HttpRequest(DEFAULT_URI); assertNotNull("DoS prevention header not present in request.", request.getHeader(HttpRequest.DOS_PREVENTION_HEADER)); }
@Test public void getHeader() throws Exception { Map<String, List<String>> headers = Maps.newHashMap(); headers.put(TEST_HEADER_KEY, Arrays.asList(TEST_HEADER_VALUE)); HttpRequest request = new HttpRequest(DEFAULT_URI) .addHeader(TEST_HEADER_KEY, TEST_HEADER_VALUE); assertEquals(TEST_HEADER_VALUE, request.getHeader(TEST_HEADER_KEY)); }