@Override
    public void entry(Context context, ResourceWrapper resourceWrapper, DefaultNode node, int count,
                      boolean prioritized, Object... args) throws Throwable {
        if (!ParamFlowRuleManager.hasRules(resourceWrapper.getName())) {
            fireEntry(context, resourceWrapper, node, count, prioritized, args);
            return;
        }

        checkFlow(resourceWrapper, count, args);
        fireEntry(context, resourceWrapper, node, count, prioritized, args);
    }
@Test
    public void testNegativeParamIdx() throws Throwable {
        String resourceName = "testNegativeParamIdx";
        ResourceWrapper resourceWrapper = new StringResourceWrapper(resourceName, EntryType.IN);
        ParamFlowRule rule = new ParamFlowRule(resourceName)
            .setCount(1)
            .setParamIdx(-1);
        ParamFlowRuleManager.loadRules(Collections.singletonList(rule));
        paramFlowSlot.entry(null, resourceWrapper, null, 1, false, "abc", "def", "ghi");
        assertEquals(2, rule.getParamIdx().longValue());

        rule.setParamIdx(-1);
        ParamFlowRuleManager.loadRules(Collections.singletonList(rule));
        paramFlowSlot.entry(null, resourceWrapper, null, 1, false, null);
        // Null args will not trigger conversion.
        assertEquals(-1, rule.getParamIdx().intValue());

        rule.setParamIdx(-100);
        ParamFlowRuleManager.loadRules(Collections.singletonList(rule));
        paramFlowSlot.entry(null, resourceWrapper, null, 1, false, "abc", "def", "ghi");
        assertEquals(100, rule.getParamIdx().longValue());

        rule.setParamIdx(0);
        ParamFlowRuleManager.loadRules(Collections.singletonList(rule));
        paramFlowSlot.entry(null, resourceWrapper, null, 1, false, "abc", "def", "ghi");
        assertEquals(0, rule.getParamIdx().longValue());
    }