PrimaryReplicaReplicationDataSourceRule { public Map<String, Collection<String>> getDataSourceMapper() { Map<String, Collection<String>> result = new HashMap<>(1, 1); Collection<String> actualDataSourceNames = new LinkedList<>(); actualDataSourceNames.add(primaryDataSourceName); actualDataSourceNames.addAll(replicaDataSourceNames); result.put(name, actualDataSourceNames); return result; } PrimaryReplicaReplicationDataSourceRule(final PrimaryReplicaReplicationDataSourceRuleConfiguration config, final ReplicaLoadBalanceAlgorithm loadBalancer); List<String> getReplicaDataSourceNames(); void updateDisabledDataSourceNames(final String dataSourceName, final boolean isDisabled); Map<String, Collection<String>> getDataSourceMapper();  }
@Test public void assertGetDataSourceMapper() { Map<String, Collection<String>> actual = primaryReplicaDataSourceRule.getDataSourceMapper(); Map<String, Collection<String>> expected = ImmutableMap.of("test_pr", Arrays.asList("primary_ds", "replica_ds_0", "replica_ds_1")); assertThat(actual, is(expected)); }