public static boolean isValidRule(ParamFlowRule rule) {
        return rule != null && !StringUtil.isBlank(rule.getResource()) && rule.getCount() >= 0
            && rule.getGrade() >= 0 && rule.getParamIdx() != null
            && rule.getBurstCount() >= 0 && rule.getControlBehavior() >= 0
            && rule.getDurationInSec() > 0 && rule.getMaxQueueingTimeMs() >= 0
            && checkCluster(rule) & checkRegexField(rule);
    }
@Test
    public void testCheckValidHotParamRule() {
        // Null or empty resource;
        ParamFlowRule rule1 = new ParamFlowRule();
        ParamFlowRule rule2 = new ParamFlowRule("");
        assertFalse(ParamFlowRuleUtil.isValidRule(null));
        assertFalse(ParamFlowRuleUtil.isValidRule(rule1));
        assertFalse(ParamFlowRuleUtil.isValidRule(rule2));

        // Invalid threshold count.
        ParamFlowRule rule3 = new ParamFlowRule("abc")
            .setCount(-1)
            .setParamIdx(1);
        assertFalse(ParamFlowRuleUtil.isValidRule(rule3));

        // Parameter index not set or invalid.
        ParamFlowRule rule4 = new ParamFlowRule("abc")
            .setCount(1);
        ParamFlowRule rule5 = new ParamFlowRule("abc")
            .setCount(1)
            .setParamIdx(-1);
        assertFalse(ParamFlowRuleUtil.isValidRule(rule4));
        assertTrue(ParamFlowRuleUtil.isValidRule(rule5));

        ParamFlowRule goodRule = new ParamFlowRule("abc")
            .setCount(10)
            .setParamIdx(1);
        assertTrue(ParamFlowRuleUtil.isValidRule(goodRule));
    }