@Test void testGetIntHeader() { DefaultHttpHeaderManager manager = new DefaultHttpHeaderManager(); manager.addHeader("NAME", "1"); assertEquals(1, manager.getIntHeader("NAME")); }
@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 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 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(); }
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); }
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);  }