static int getConfigValueAsInt(ServiceConfiguration conf, String configProp, int defaultValue) {
        Object value = conf.getProperty(configProp);
        if (value instanceof Integer) {
            log.info("Configuration for [{}] is [{}]", configProp, value);
            return (Integer) value;
        } else if (value instanceof String) {
            try {
                return Integer.parseInt((String) value);
            } catch (NumberFormatException numberFormatException) {
                log.error("Expected configuration for [{}] to be a long, but got [{}]. Using default value: [{}]",
                        configProp, value, defaultValue, numberFormatException);
                return defaultValue;
            }
        } else {
            log.info("Configuration for [{}] is using the default value: [{}]", configProp, defaultValue);
            return defaultValue;
        }
    }
@Test
    public void testGetConfigValueAsIntegerWorks() {
        Properties props = new Properties();
        props.setProperty("prop1", "1234");
        ServiceConfiguration config = new ServiceConfiguration();
        config.setProperties(props);
        int actual = ConfigUtils.getConfigValueAsInt(config, "prop1", 9);
        assertEquals(1234, actual);
    }