boolean matchWhen(URL url, Invocation invocation) {
        if (CollectionUtils.isEmptyMap(whenCondition)) {
            return true;
        }

        return doMatch(url, null, invocation, whenCondition, true);
    }
@Test
    void testRoute_matchWhen() {
        Invocation invocation = new RpcInvocation();

        StateRouter router =
                new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl(" => host = 1.2.3.4"));
        boolean matchWhen = ((ConditionStateRouter) router)
                .matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"), invocation);
        Assertions.assertTrue(matchWhen);

        router = new ConditionStateRouterFactory()
                .getRouter(String.class, getRouteUrl("host = 2.2.2.2,1.1.1.1,3.3.3.3 => host = 1.2.3.4"));
        matchWhen = ((ConditionStateRouter) router)
                .matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"), invocation);
        Assertions.assertTrue(matchWhen);

        router = new ConditionStateRouterFactory()
                .getRouter(
                        String.class, getRouteUrl("host = 2.2.2.2,1.1.1.1,3.3.3.3 & host !=1.1.1.1 => host = 1.2.3.4"));
        matchWhen = ((ConditionStateRouter) router)
                .matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"), invocation);
        Assertions.assertFalse(matchWhen);

        router = new ConditionStateRouterFactory()
                .getRouter(
                        String.class, getRouteUrl("host !=4.4.4.4 & host = 2.2.2.2,1.1.1.1,3.3.3.3 => host = 1.2.3.4"));
        matchWhen = ((ConditionStateRouter) router)
                .matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"), invocation);
        Assertions.assertTrue(matchWhen);

        router = new ConditionStateRouterFactory()
                .getRouter(
                        String.class, getRouteUrl("host !=4.4.4.* & host = 2.2.2.2,1.1.1.1,3.3.3.3 => host = 1.2.3.4"));
        matchWhen = ((ConditionStateRouter) router)
                .matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"), invocation);
        Assertions.assertTrue(matchWhen);

        router = new ConditionStateRouterFactory()
                .getRouter(
                        String.class,
                        getRouteUrl("host = 2.2.2.2,1.1.1.*,3.3.3.3 & host != 1.1.1.1 => host = 1.2.3.4"));
        matchWhen = ((ConditionStateRouter) router)
                .matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"), invocation);
        Assertions.assertFalse(matchWhen);

        router = new ConditionStateRouterFactory()
                .getRouter(
                        String.class,
                        getRouteUrl("host = 2.2.2.2,1.1.1.*,3.3.3.3 & host != 1.1.1.2 => host = 1.2.3.4"));
        matchWhen = ((ConditionStateRouter) router)
                .matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"), invocation);
        Assertions.assertTrue(matchWhen);
    }