@Override
    public boolean needToLoad(FilterInvoker invoker) {
        AbstractInterfaceConfig<?, ?> config = invoker.getConfig();

        String enabled = config.getParameter(SentinelConstants.SOFA_RPC_SENTINEL_ENABLED);
        if (StringUtils.isNotBlank(enabled)) {
            return Boolean.parseBoolean(enabled);
        }

        return RpcConfigs.getOrDefaultValue(SentinelConstants.SOFA_RPC_SENTINEL_ENABLED, true);
    }
@Test
    public void testNeedToLoadConsumer() {
        SentinelSofaRpcConsumerFilter consumerFilter = new SentinelSofaRpcConsumerFilter();
        ConsumerConfig consumerConfig = new ConsumerConfig();
        consumerConfig.setInterfaceId(Serializer.class.getName());
        consumerConfig.setId("BBB");
        FilterInvoker invoker = new FilterInvoker(null, null, consumerConfig);
        assertTrue(consumerFilter.needToLoad(invoker));

        consumerConfig.setParameter(SentinelConstants.SOFA_RPC_SENTINEL_ENABLED, "false");
        assertFalse(consumerFilter.needToLoad(invoker));

        consumerConfig.setParameter(SentinelConstants.SOFA_RPC_SENTINEL_ENABLED, "");
        assertTrue(consumerFilter.needToLoad(invoker));

        RpcConfigs.putValue(SentinelConstants.SOFA_RPC_SENTINEL_ENABLED, "false");
        assertFalse(consumerFilter.needToLoad(invoker));
    }