protected boolean resourceNameMatches(Role.PolicyRule rule, String requestedName) {
        if (ArrayUtils.isEmpty(rule.getResourceNames())) {
            return true;
        }
        String[] requestedNameParts = ArrayUtils.nullToEmpty(StringUtils.split(requestedName, "/"));
        for (String ruleName : rule.getResourceNames()) {
            String[] patternParts = StringUtils.split(ruleName, "/");

            for (int i = 0; i < patternParts.length; i++) {
                String patternPart = patternParts[i];
                String textPart = StringUtils.EMPTY;
                if (requestedNameParts.length > i) {
                    textPart = requestedNameParts[i];
                }

                if (!matchPart(patternPart, textPart)) {
                    return false;
                }
            }

            return true;
        }
        return false;
    }
@Test
    void resourceNameMatches() {
        RbacRequestEvaluation rbacRequestEvaluation = new RbacRequestEvaluation();
        assertThat(matchResourceName(rbacRequestEvaluation, "", "fake/test")).isTrue();
        assertThat(matchResourceName(rbacRequestEvaluation, "", "fake")).isTrue();
        assertThat(matchResourceName(rbacRequestEvaluation, "", "")).isTrue();
        assertThat(matchResourceName(rbacRequestEvaluation, "*", null)).isTrue();

        assertThat(matchResourceName(rbacRequestEvaluation, "*/test", "fake/test")).isTrue();

        assertThat(matchResourceName(rbacRequestEvaluation, "*/test", "hello/test")).isTrue();
        assertThat(matchResourceName(rbacRequestEvaluation, "*/test", "hello/fake")).isFalse();

        assertThat(matchResourceName(rbacRequestEvaluation, "test/*", "hello/fake")).isFalse();
        assertThat(matchResourceName(rbacRequestEvaluation, "test/*", "test/fake")).isTrue();
        assertThat(matchResourceName(rbacRequestEvaluation, "test/*", "test")).isTrue();
        assertThat(matchResourceName(rbacRequestEvaluation, "test/*", "hello")).isFalse();

        assertThat(matchResourceName(rbacRequestEvaluation, "*/*", "test/fake")).isTrue();
        assertThat(matchResourceName(rbacRequestEvaluation, "*/*", "test")).isTrue();

        assertThat(matchResourceName(rbacRequestEvaluation, "*", "test")).isTrue();
        assertThat(matchResourceName(rbacRequestEvaluation, "*", "hello")).isTrue();
    }