static ParamFlowRule applyToParamRule(/*@Valid*/ GatewayFlowRule gatewayRule, int idx) {
        ParamFlowRule paramRule = new ParamFlowRule(gatewayRule.getResource())
            .setCount(gatewayRule.getCount())
            .setGrade(gatewayRule.getGrade())
            .setDurationInSec(gatewayRule.getIntervalSec())
            .setBurstCount(gatewayRule.getBurst())
            .setControlBehavior(gatewayRule.getControlBehavior())
            .setMaxQueueingTimeMs(gatewayRule.getMaxQueueingTimeoutMs())
            .setParamIdx(idx);
        GatewayParamFlowItem gatewayItem = gatewayRule.getParamItem();
        // Apply the current idx to gateway rule item.
        gatewayItem.setIndex(idx);
        // Apply for pattern-based parameters.
        String valuePattern = gatewayItem.getPattern();
        if (valuePattern != null) {
            paramRule.getParamFlowItemList().add(generateNonMatchPassParamItem());
        }
        return paramRule;
    }
@Test
    public void testConvertAndApplyToParamRule() {
        GatewayFlowRule routeRule1 = new GatewayFlowRule("routeId1")
            .setCount(2)
            .setIntervalSec(2)
            .setBurst(2)
            .setParamItem(new GatewayParamFlowItem()
                .setParseStrategy(SentinelGatewayConstants.PARAM_PARSE_STRATEGY_CLIENT_IP)
            );
        int idx = 1;
        ParamFlowRule paramRule = GatewayRuleConverter.applyToParamRule(routeRule1, idx);
        assertEquals(routeRule1.getResource(), paramRule.getResource());
        assertEquals(routeRule1.getCount(), paramRule.getCount(), 0.01);
        assertEquals(routeRule1.getControlBehavior(), paramRule.getControlBehavior());
        assertEquals(routeRule1.getIntervalSec(), paramRule.getDurationInSec());
        assertEquals(routeRule1.getBurst(), paramRule.getBurstCount());
        assertEquals(idx, (int)paramRule.getParamIdx());
        assertEquals(idx, (int)routeRule1.getParamItem().getIndex());
    }