protected static int getConfigInt(String name, int defaultVal, int minVal) {
        if (cacheMap.containsKey(name)) {
            return (int)cacheMap.get(name);
        }
        int val = NumberUtils.toInt(getConfig(name));
        if (val == 0) {
            val = defaultVal;
        } else if (val < minVal) {
            val = minVal;
        }
        cacheMap.put(name, val);
        return val;
    }
@Test
    public void testGetConfigInt() {
        // clear cache
        DashboardConfig.clearCache();

        // default value
        assertEquals(0, DashboardConfig.getConfigInt("t", 0, 10));
        DashboardConfig.clearCache();
        assertEquals(1, DashboardConfig.getConfigInt("t", 1, 10));
        
        // property, wrong format
        System.setProperty("t", "asdf");
        DashboardConfig.clearCache();
        assertEquals(0, DashboardConfig.getConfigInt("t", 0, 10));
        System.setProperty("t", "");
        DashboardConfig.clearCache();
        assertEquals(0, DashboardConfig.getConfigInt("t", 0, 10));
        
        // min value
        System.setProperty("t", "2");
        DashboardConfig.clearCache();
        assertEquals(2, DashboardConfig.getConfigInt("t", 0, 1));
        DashboardConfig.clearCache();
        assertEquals(10, DashboardConfig.getConfigInt("t", 0, 10));
        DashboardConfig.clearCache();
        assertEquals(2, DashboardConfig.getConfigInt("t", 0, -1));
        
        // env
        environmentVariables.set("t", "20");
        DashboardConfig.clearCache();
        assertEquals(20, DashboardConfig.getConfigInt("t", 0, 10));
        
        // wrong format env var, but it will override property
        environmentVariables.set("t", "20dddd");
        DashboardConfig.clearCache();
        assertEquals(0, DashboardConfig.getConfigInt("t", 0, 10));
        
        // clear env, it will take property
        environmentVariables.set("t", "");
        DashboardConfig.clearCache();
        assertEquals(10, DashboardConfig.getConfigInt("t", 0, 10));
        DashboardConfig.clearCache();
        assertEquals(2, DashboardConfig.getConfigInt("t", 0, 1));
        
        // enable cache
        System.setProperty("t", "666");
        DashboardConfig.clearCache();
        assertEquals(666, DashboardConfig.getConfigInt("t", 0, 1));
        System.setProperty("t", "777");
        assertEquals(666, DashboardConfig.getConfigInt("t", 0, 1));
        System.setProperty("t", "555");
        assertEquals(666, DashboardConfig.getConfigInt("t", 0, 1));
    }