public static int toInt(final String str, final int defaultValue) {
        if (str == null) {
            return defaultValue;
        }
        try {
            return Integer.parseInt(str);
        } catch (NumberFormatException nfe) {
            return defaultValue;
        }
    }
@Test
    public void testToInReturnDefaultValueWithFormatIsInvalid() {
        Assertions.assertEquals(10, NumberUtils.toInt("nine", 10));
    }