YamlRuleConfigurationSwapperEngine { @SuppressWarnings("unchecked") public Collection<YamlRuleConfiguration> swapToYamlConfigurations(final Collection<RuleConfiguration> ruleConfigurations) { Collection<YamlRuleConfiguration> result = new LinkedList<>(); for (Entry<RuleConfiguration, YamlRuleConfigurationSwapper> entry : OrderedSPIRegistry.getRegisteredServices(ruleConfigurations, YamlRuleConfigurationSwapper.class).entrySet()) { result.add((YamlRuleConfiguration) entry.getValue().swapToYamlConfiguration(entry.getKey())); } return result; }  @SuppressWarnings("unchecked") Collection<YamlRuleConfiguration> swapToYamlConfigurations(final Collection<RuleConfiguration> ruleConfigurations); Collection<RuleConfiguration> swapToRuleConfigurations(final Collection<YamlRuleConfiguration> yamlRuleConfigs); @SneakyThrows(ReflectiveOperationException.class) static Map<String, Class<?>> getYamlShortcuts();  }
@Test public void assertSwapToYamlConfigurations() { FixtureRuleConfiguration ruleConfig = new FixtureRuleConfiguration(); ruleConfig.setName("test"); Collection<YamlRuleConfiguration> actual = new YamlRuleConfigurationSwapperEngine().swapToYamlConfigurations(Collections.singletonList(ruleConfig)); assertThat(actual.size(), is(1)); assertThat(((FixtureYamlRuleConfiguration) actual.iterator().next()).getName(), is("test")); }