QuickUriGroupingRule read() {
        QuickUriGroupingRule quickUriGroupingRule = new QuickUriGroupingRule();

        if (Objects.nonNull(yamlData)) {
            List rulesData = (List) yamlData.get("grouping");
            if (rulesData != null) {
                rulesData.forEach(ruleObj -> {
                    final Map rule = (Map) ruleObj;
                    final String serviceName = (String) rule.get("service-name");
                    if (StringUtil.isEmpty(serviceName)) {
                        throw new IllegalArgumentException("service-name can't be empty");
                    }
                    final List endpointRules = (List) rule.get("rules");
                    if (endpointRules != null) {
                        endpointRules.forEach(endpointRuleObj -> {
                            final String pattern = (String) endpointRuleObj;
                            if (StringUtil.isEmpty(pattern)) {
                                return;
                            }
                            quickUriGroupingRule.addRule(serviceName, pattern);
                        });
                    }
                });
            }
        }

        return quickUriGroupingRule;
    }
@Test
    public void testReadingRule() {
        EndpointGroupingRuleReader reader = new EndpointGroupingRuleReader(this.getClass()
                                                                               .getClassLoader()
                                                                               .getResourceAsStream(
                                                                                   "endpoint-name-grouping.yml"));
        final QuickUriGroupingRule rule = reader.read();

        StringFormatGroup.FormatResult formatResult = rule.format("serviceA", "/prod/123");
        Assertions.assertTrue(formatResult.isMatch());
        Assertions.assertEquals("/prod/{var}", formatResult.getReplacedName());

        // This will always match, since after slicing length is 1, which goes into special handling
        formatResult = rule.format("serviceA", "/prod/");
        Assertions.assertTrue(formatResult.isMatch());
        Assertions.assertEquals("/prod/", formatResult.getReplacedName());

        formatResult = rule.format("serviceA", "/prod/123/456");
        Assertions.assertFalse(formatResult.isMatch());
        Assertions.assertEquals("/prod/123/456", formatResult.getReplacedName());

        formatResult = rule.format("serviceB", "/prod/123");
        Assertions.assertFalse(formatResult.isMatch());
    }