提交 2968a1e7 编写于 作者: T terrymanu

update checkstyle for Class Design

上级 d3107314
......@@ -204,7 +204,7 @@ public abstract class AbstractSQLTest {
}
@AfterClass
public static void clear() throws SQLException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
public static void clear() throws SQLException, ReflectiveOperationException {
if (!shardingDataSources.isEmpty()) {
for (ShardingDataSource each : shardingDataSources.values()) {
each.close();
......
......@@ -44,7 +44,7 @@ import static org.junit.Assert.assertThat;
public class YamlShardingDataSourceTest {
@Test
public void assertAll() throws IOException, NoSuchFieldException, IllegalAccessException, URISyntaxException, SQLException {
public void assertAll() throws SQLException, IOException, URISyntaxException, ReflectiveOperationException {
ShardingRule shardingRule = getShardingRule("/yaml/config/config-all.yaml");
assertThat(shardingRule.getTableRules().size(), is(3));
assertThat(shardingRule.getBindingTableRules().size(), is(1));
......@@ -53,7 +53,7 @@ public class YamlShardingDataSourceTest {
}
@Test
public void assertMin() throws IOException, ReflectiveOperationException, URISyntaxException, SQLException {
public void assertMin() throws SQLException, IOException, URISyntaxException, ReflectiveOperationException {
Map<String, DataSource> dataSourceMap = new HashMap<>(1);
dataSourceMap.put("ds", createDataSource());
ShardingRule shardingRule = getShardingRule(dataSourceMap, "/yaml/config/config-min.yaml");
......@@ -61,12 +61,12 @@ public class YamlShardingDataSourceTest {
}
@Test(expected = ShardingJdbcException.class)
public void assertClassNotFound() throws IOException, NoSuchFieldException, IllegalAccessException, URISyntaxException, SQLException {
public void assertClassNotFound() throws SQLException, IOException, URISyntaxException, ReflectiveOperationException {
getShardingRule("/yaml/config/config-classNotFound.yaml");
}
@Test(expected = IllegalStateException.class)
public void assertBindingError() throws IOException, ReflectiveOperationException, URISyntaxException, SQLException {
public void assertBindingError() throws SQLException, IOException, URISyntaxException, ReflectiveOperationException {
Map<String, DataSource> dataSourceMap = new HashMap<>(1);
dataSourceMap.put("ds", createDataSource());
ShardingRule shardingRule = getShardingRule(dataSourceMap, "/yaml/config/config-bindingError.yaml");
......@@ -75,15 +75,15 @@ public class YamlShardingDataSourceTest {
}
}
private ShardingRule getShardingRule(final String fileName) throws NoSuchFieldException, IllegalAccessException, URISyntaxException, IOException, SQLException {
private ShardingRule getShardingRule(final String fileName) throws SQLException, IOException, URISyntaxException, ReflectiveOperationException {
return getShardingRule(ShardingDataSourceFactory.createDataSource(new File(getClass().getResource(fileName).toURI())));
}
private ShardingRule getShardingRule(final Map<String, DataSource> dataSourceMap, final String fileName) throws ReflectiveOperationException, URISyntaxException, IOException, SQLException {
private ShardingRule getShardingRule(final Map<String, DataSource> dataSourceMap, final String fileName) throws SQLException, IOException, URISyntaxException, ReflectiveOperationException {
return getShardingRule(ShardingDataSourceFactory.createDataSource(dataSourceMap, new File(getClass().getResource(fileName).toURI())));
}
private ShardingRule getShardingRule(final DataSource shardingDataSource) throws NoSuchFieldException, IllegalAccessException {
private ShardingRule getShardingRule(final DataSource shardingDataSource) throws ReflectiveOperationException {
Field field = ShardingDataSource.class.getDeclaredField("shardingContext");
field.setAccessible(true);
ShardingContext shardingContext = (ShardingContext) field.get(shardingDataSource);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册