public static ReadwriteSplittingRuleConfiguration convert(final Collection<ReadwriteSplittingRuleSegment> ruleSegments) {
        Collection<ReadwriteSplittingDataSourceGroupRuleConfiguration> dataSourceGroups = new LinkedList<>();
        Map<String, AlgorithmConfiguration> loadBalancers = new HashMap<>(ruleSegments.size(), 1F);
        for (ReadwriteSplittingRuleSegment each : ruleSegments) {
            if (null == each.getLoadBalancer()) {
                dataSourceGroups.add(createDataSourceGroupRuleConfiguration(each, null));
            } else {
                String loadBalancerName = getLoadBalancerName(each.getName(), each.getLoadBalancer().getName());
                loadBalancers.put(loadBalancerName, createLoadBalancer(each));
                dataSourceGroups.add(createDataSourceGroupRuleConfiguration(each, loadBalancerName));
            }
        }
        return new ReadwriteSplittingRuleConfiguration(dataSourceGroups, loadBalancers);
    }
@Test
    void assertEmptyRuleSegmentConvertResult() {
        ReadwriteSplittingRuleConfiguration actualEmptyRuleSegmentConvertResult = ReadwriteSplittingRuleStatementConverter
                .convert(Collections.emptyList());
        assertTrue(actualEmptyRuleSegmentConvertResult.getDataSourceGroups().isEmpty());
        assertTrue(actualEmptyRuleSegmentConvertResult.getLoadBalancers().isEmpty());
    }