DefaultHttpHeaderManager implements HttpHeaderManager { @Override public int getIntHeader(String name) throws NumberFormatException { int result = -1; if (headers.containsKey(name.toUpperCase(locale))) { DefaultHttpHeader header = headers.get(name.toUpperCase(locale)); try { result = Integer.parseInt(header.getValue()); } catch (NumberFormatException exception) { throw new NumberFormatException( "Cannot convert header to an int"); } } return result; } DefaultHttpHeaderManager(); @Override void addHeader(String name, String value); @Override boolean containsHeader(String name); @Override long getDateHeader(String name); @Override String getHeader(String name); @Override Enumeration<String> getHeaderNames(); @Override Enumeration<String> getHeaders(String name); @Override int getIntHeader(String name); @Override void setHeader(String name, String value);  }
@Test void testGetIntHeader() { DefaultHttpHeaderManager manager = new DefaultHttpHeaderManager(); manager.addHeader("NAME", "1"); assertEquals(1, manager.getIntHeader("NAME")); }
@Test void testGetIntHeader3() { DefaultHttpHeaderManager manager = new DefaultHttpHeaderManager(); assertEquals(-1, manager.getIntHeader("NAME")); }