ProxyUserYamlSwapper implements YamlSwapper<YamlProxyUserConfiguration, ProxyUser> { @Override public YamlProxyUserConfiguration swapToYamlConfiguration(final ProxyUser data) { YamlProxyUserConfiguration result = new YamlProxyUserConfiguration(); result.setPassword(data.getPassword()); String authorizedSchemas = null == data.getAuthorizedSchemas() ? "" : Joiner.on(',').join(data.getAuthorizedSchemas()); result.setAuthorizedSchemas(authorizedSchemas); return result; }  @Override YamlProxyUserConfiguration swapToYamlConfiguration(final ProxyUser data); @Override ProxyUser swapToObject(final YamlProxyUserConfiguration yamlConfig);  }
@Test public void assertSwapToYaml() { YamlProxyUserConfiguration actual = new ProxyUserYamlSwapper().swapToYamlConfiguration(new ProxyUser("pwd", Collections.singleton("db1"))); assertThat(actual.getAuthorizedSchemas(), is("db1")); assertThat(actual.getPassword(), is("pwd")); }