### Question:
HttpRequest { public long getContentLength() { if (headers == null) { return 0; } final String len = headers.get(HttpHeader.CONTENT_LENGTH); if (len == null || len.isEmpty()) { return 0; } return Long.valueOf(len); } HttpRequest(String method, URI uri); @SuppressWarnings("unchecked")  HttpRequest(String method, URI uri, Map<String, String> headers, InputStream content); String getMethod(); URI getUri(); Map<String, String> getHeaders(); InputStream getContent(); long getContentLength(); boolean isStreaming(); @SuppressWarnings("checkstyle:hiddenfield") void setStreaming(boolean isStreaming);  }### Answer:
@Test public void testContentLength() { long contentLength = 100; headers.put(HttpHeader.CONTENT_LENGTH, String.valueOf(contentLength)); HttpRequest request = new HttpRequest(method, uri, headers, null); assertTrue("content length", request.getContentLength() == contentLength); }
@Test public void testNoContentLength() { request = new HttpRequest(method, uri, headers, content); assertTrue("content length", request.getContentLength() == 0); }