ShardingAutoTableRuleConfigurationYamlSwapper implements YamlSwapper<YamlShardingAutoTableRuleConfiguration, ShardingAutoTableRuleConfiguration> { @Override public ShardingAutoTableRuleConfiguration swapToObject(final YamlShardingAutoTableRuleConfiguration yamlConfig) { Preconditions.checkNotNull(yamlConfig.getLogicTable(), "Logic table cannot be null."); ShardingAutoTableRuleConfiguration result = new ShardingAutoTableRuleConfiguration(yamlConfig.getLogicTable(), yamlConfig.getActualDataSources()); if (null != yamlConfig.getShardingStrategy()) { result.setShardingStrategy(shardingStrategyYamlSwapper.swapToObject(yamlConfig.getShardingStrategy())); } if (null != yamlConfig.getKeyGenerateStrategy()) { result.setKeyGenerateStrategy(keyGenerateStrategyYamlSwapper.swapToObject(yamlConfig.getKeyGenerateStrategy())); } return result; }  @Override YamlShardingAutoTableRuleConfiguration swapToYamlConfiguration(final ShardingAutoTableRuleConfiguration data); @Override ShardingAutoTableRuleConfiguration swapToObject(final YamlShardingAutoTableRuleConfiguration yamlConfig);  }
@Test(expected = NullPointerException.class) public void assertSwapToObjectWithoutLogicTable() { new ShardingAutoTableRuleConfigurationYamlSwapper().swapToObject(new YamlShardingAutoTableRuleConfiguration()); }