NumberUtils { public static Integer tryParseInt(String toParse) { try { return Integer.parseInt(toParse); } catch (NumberFormatException e) { return null; } } private  NumberUtils(); static Integer tryParseInt(String toParse);  }
@Test public void tryParseInt_ValidInt_ReturnsValidInteger() { assertIntEquals(7, NumberUtils.tryParseInt("7")); }
@Test public void tryParseInt_InvalidInt_ReturnsNull() { assertNull(NumberUtils.tryParseInt("seven")); }
@Test public void tryParseInt_NullString_ReturnsNull() { assertNull(NumberUtils.tryParseInt(null)); }
@Test public void tryParseInt_EmptyString_ReturnsNull() { assertNull(NumberUtils.tryParseInt("")); }