@Override
    public void removeRule(final RuleData ruleData) {
        String key = CacheKeyUtils.INST.getKey(ruleData);
        CACHED_HANDLE.get().removeHandle(key);
        FlowRuleManager.loadRules(FlowRuleManager.getRules()
                .stream()
                .filter(r -> !r.getResource().equals(key))
                .collect(Collectors.toList()));
        DegradeRuleManager.loadRules(DegradeRuleManager.getRules()
                .stream()
                .filter(r -> !r.getResource().equals(key))
                .collect(Collectors.toList()));
    }
@Test
    public void removeRule() {
        RuleData data = new RuleData();
        data.setSelectorId("sentinel");
        data.setId("removeRule");
        SentinelHandle sentinelHandle = new SentinelHandle();
        sentinelHandle.setFlowRuleCount(10);
        sentinelHandle.setFlowRuleGrade(0);
        sentinelHandle.setFlowRuleControlBehavior(0);
        sentinelHandle.setDegradeRuleCount(1d);
        sentinelHandle.setDegradeRuleGrade(0);
        sentinelHandle.setDegradeRuleTimeWindow(5);
        sentinelHandle.setDegradeRuleMinRequestAmount(5);
        sentinelHandle.setDegradeRuleStatIntervals(10);
        sentinelHandle.setDegradeRuleSlowRatioThreshold(0.5d);
        data.setHandle(GsonUtils.getGson().toJson(sentinelHandle));
        sentinelRuleHandle.handlerRule(data);
        FlowRule flowRule = FlowRuleManager.getRules().get(0);
        assertThat(flowRule.getCount(), is(10.0));
        assertThat(flowRule.getResource(), is("sentinel_removeRule"));
        DegradeRule degradeRule = DegradeRuleManager.getRules().get(0);
        assertThat(degradeRule.getCount(), is(1.0));
        assertThat(degradeRule.getResource(), is("sentinel_removeRule"));
        sentinelRuleHandle.removeRule(data);
        assertTrue(FlowRuleManager.getRules().isEmpty());
        assertTrue(DegradeRuleManager.getRules().isEmpty());
    }