HeaderHelper { public static long getContentLengthLong(MultivaluedMap<String, String> httpHeaders) { String contentLengthHeader = httpHeaders.getFirst(HttpHeaders.CONTENT_LENGTH); return contentLengthHeader == null ? 0 : Long.parseLong(contentLengthHeader); } private  HeaderHelper(); static List<AcceptMediaType> createAcceptMediaTypeList(String header); static List<AcceptLanguage> createAcceptedLanguageList(String header); static List<AcceptToken> createAcceptedCharsetList(String header); static List<AcceptToken> createAcceptedEncodingList(String header); static List<Cookie> parseCookies(String cookiesString); static NewCookie parseNewCookie(String newCookieString); static Date parseDateHeader(String header); static String formatDate(Date date); static long getContentLengthLong(MultivaluedMap<String, String> httpHeaders); @SuppressWarnings({"unchecked"}) static String getHeaderAsString(Object o); static String convertToString(Collection<String> collection); static final Comparator<QualityValue> QUALITY_VALUE_COMPARATOR; }
@Test public void getsContentLengthAsLong() throws Exception { MultivaluedMap<String, String> headers = new MultivaluedMapImpl(); headers.putSingle(HttpHeaders.CONTENT_LENGTH, "111"); final long contentLength = HeaderHelper.getContentLengthLong(headers); assertEquals(111L, contentLength); }