public static boolean isGzipCompressionEnabledForEndpoint(List<String> gzipCompressionExcludedPaths,
                                                              String endpoint) {
        if (gzipCompressionExcludedPaths == null || gzipCompressionExcludedPaths.isEmpty()) {
            return true;
        }
        if (isGzipCompressionCompletelyDisabled(gzipCompressionExcludedPaths)) {
            return false;
        }
        IncludeExclude<String> paths = new IncludeExclude<>(PathSpecSet.class);
        paths.exclude(gzipCompressionExcludedPaths.toArray(new String[0]));
        return paths.test(endpoint);
    }
@Test
    public void testIsGzipCompressionEnabledForEndpoint() {
        assertTrue(GzipHandlerUtil.isGzipCompressionEnabledForEndpoint(null, "/metrics"));
        assertFalse(GzipHandlerUtil.isGzipCompressionEnabledForEndpoint(Arrays.asList("^.*"), "/metrics"));
        assertFalse(GzipHandlerUtil.isGzipCompressionEnabledForEndpoint(Arrays.asList("^.*$"), "/metrics"));
        assertFalse(GzipHandlerUtil.isGzipCompressionEnabledForEndpoint(Arrays.asList("/metrics"), "/metrics"));
        assertTrue(GzipHandlerUtil.isGzipCompressionEnabledForEndpoint(Arrays.asList("/metrics"), "/metrics2"));
        assertTrue(GzipHandlerUtil.isGzipCompressionEnabledForEndpoint(Arrays.asList("/admin", "/custom"), "/metrics"));
    }