@Override
    public ReadwriteSplittingRuleConfiguration swapToObject(final YamlReadwriteSplittingRuleConfiguration yamlConfig) {
        Collection<ReadwriteSplittingDataSourceGroupRuleConfiguration> dataSources = yamlConfig.getDataSourceGroups().entrySet().stream()
                .map(entry -> swapToObject(entry.getKey(), entry.getValue())).collect(Collectors.toList());
        Map<String, AlgorithmConfiguration> loadBalancerMap = null == yamlConfig.getLoadBalancers()
                ? Collections.emptyMap()
                : yamlConfig.getLoadBalancers().entrySet().stream().collect(Collectors.toMap(Entry::getKey, entry -> algorithmSwapper.swapToObject(entry.getValue())));
        return new ReadwriteSplittingRuleConfiguration(dataSources, loadBalancerMap);
    }
@Test
    void assertSwapToObject() {
        ReadwriteSplittingRuleConfiguration actual = getSwapper().swapToObject(createYamlReadwriteSplittingRuleConfiguration());
        assertThat(actual.getDataSourceGroups().size(), is(1));
        assertThat(actual.getLoadBalancers().size(), is(1));
        assertReadwriteSplittingRule(actual);
    }