PrimaryReplicaReplicationRuleBuilder implements ShardingSphereRuleBuilder<PrimaryReplicaReplicationRule, PrimaryReplicaReplicationRuleConfiguration> { @Override public PrimaryReplicaReplicationRule build(final PrimaryReplicaReplicationRuleConfiguration ruleConfig, final Collection<String> dataSourceNames) { return new PrimaryReplicaReplicationRule(ruleConfig); }  @Override PrimaryReplicaReplicationRule build(final PrimaryReplicaReplicationRuleConfiguration ruleConfig, final Collection<String> dataSourceNames); @Override int getOrder(); @Override Class<PrimaryReplicaReplicationRuleConfiguration> getTypeClass();  }
@SuppressWarnings({"rawtypes", "unchecked"}) @Test public void assertBuild() { PrimaryReplicaReplicationRuleConfiguration ruleConfig = mock(PrimaryReplicaReplicationRuleConfiguration.class); PrimaryReplicaReplicationDataSourceRuleConfiguration dataSourceRuleConfig = new PrimaryReplicaReplicationDataSourceRuleConfiguration( "name", "primaryDataSourceName", Collections.singletonList("name"), "loadBalancerName"); when(ruleConfig.getDataSources()).thenReturn(Collections.singletonList(dataSourceRuleConfig)); ShardingSphereRuleBuilder builder = OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), ShardingSphereRuleBuilder.class).get(ruleConfig); assertThat(builder.build(ruleConfig, Collections.emptyList()), instanceOf(PrimaryReplicaReplicationRule.class)); }