### Question:
HttpHelper { public static int toInt(final String value, final int def) { if (Strings.isNullOrEmpty(value)) { return def; } try { return Integer.parseInt(value); } catch (final NumberFormatException e) { logger.warn(e); return def; } } private  HttpHelper(); static long toLong(final String value, final long def); static int toInt(final String value, final int def);  }### Answer:
@Test public void testToInt() throws Exception { assertEquals(1, HttpHelper.toInt("1", 0)); assertEquals(-1, HttpHelper.toInt("-1", 0)); assertEquals(0, HttpHelper.toInt("1a", 0)); assertEquals(0, HttpHelper.toInt("a", 0)); }