YamlShardingSphereAlgorithmConfiguration implements YamlConfiguration { public static YamlShardingSphereAlgorithmConfiguration buildByTypedSPI(final TypedSPI value) { YamlShardingSphereAlgorithmConfiguration result = new YamlShardingSphereAlgorithmConfiguration(); result.setType(value.getType()); result.setProps(value.getProps()); return result; }  static YamlShardingSphereAlgorithmConfiguration buildByTypedSPI(final TypedSPI value);  }
@Test public void assertBuildByTypedSPI() { ShardingSphereServiceLoader.register(TypedSPIFixture.class); Collection<TypedSPIFixture> spiFixtures = ShardingSphereServiceLoader.newServiceInstances(TypedSPIFixture.class); Optional<TypedSPIFixture> spiOptional = spiFixtures.stream().filter(echo -> echo instanceof TypedSPIFixtureImpl).findFirst(); assertTrue(spiOptional.isPresent()); TypedSPIFixture typedSPIFixture = spiOptional.get(); typedSPIFixture.setProps(createProps()); YamlShardingSphereAlgorithmConfiguration actual = YamlShardingSphereAlgorithmConfiguration.buildByTypedSPI(typedSPIFixture); assertThat(actual.getType(), is("FIXTURE")); assertThat(actual.getProps().getProperty("key"), is("value")); }