@Test
    public void testCorsWhitelist() {
        ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest
                .get("http://localhost:8080")
                .header("Origin", "http://a.apache.org")
                .build());
        WebFilterChain chainNormal = mock(WebFilterChain.class);
        when(chainNormal.filter(exchange)).thenReturn(Mono.empty());
        final CrossFilterConfig filterConfig = new CrossFilterConfig();
        CrossFilterConfig.AllowedOriginConfig allowedOriginConfig = new CrossFilterConfig.AllowedOriginConfig();
        allowedOriginConfig.setDomain("apache.org");
        allowedOriginConfig.setPrefixes(new HashSet<>() {
            {
                add("a");
            }
        });
        allowedOriginConfig.setOrigins(new HashSet<>() {
            {
                add("b.apache.org");
                add("c.apache.org");
                add("http://d.apache.org");
                add("*");
            }
        });
        filterConfig.setAllowedOrigin(allowedOriginConfig);
        CrossFilter filter = new CrossFilter(filterConfig);
        StepVerifier.create(filter.filter(exchange, chainNormal))
                .expectSubscription()
                .verifyComplete();
        allowedOriginConfig.setOrigins(new HashSet<>() {
            {
                add("a.apache.org");
            }
        });
        StepVerifier.create(new CrossFilter(filterConfig).filter(exchange, chainNormal))
                .expectSubscription()
                .verifyComplete();

        filterConfig.setAllowedAnyOrigin(true);
        StepVerifier.create(new CrossFilter(filterConfig).filter(exchange, chainNormal))
                .expectSubscription()
                .verifyComplete();
        filterConfig.setAllowedOrigin(null);
        StepVerifier.create(new CrossFilter(filterConfig).filter(exchange, chainNormal))
                .expectSubscription()
                .verifyComplete();

        filterConfig.setAllowedAnyOrigin(false);
        allowedOriginConfig.setOrigins(new HashSet<>() {
            {
                add("*");
            }
        });
        allowedOriginConfig.setPrefixes(null);
        filterConfig.setAllowedOrigin(allowedOriginConfig);
        StepVerifier.create(new CrossFilter(filterConfig).filter(exchange, chainNormal))
                .expectSubscription()
                .verifyComplete();
    }
test method for {@link CrossFilter#filter(ServerWebExchange, WebFilterChain)}.
shenyu-web/src/test/java/org/apache/shenyu/web/filter/CrossFilterTest.java