This is an automated email from the ASF dual-hosted git repository.
zhaojinchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new ac920a1f050 Optimize the import of `org.junit.jupiter.api.Assertions`
(#28878)
ac920a1f050 is described below
commit ac920a1f05066acb097c3dbb47a6ef4e6b7eb726
Author: Raigor <[email protected]>
AuthorDate: Fri Oct 27 02:42:25 2023 -0500
Optimize the import of `org.junit.jupiter.api.Assertions` (#28878)
* Optimize the import of org.junit.jupiter.api.Assertions
* Fix spotless
---
.../ral/queryable/ConvertYamlConfigurationExecutorTest.java | 11 ++++-------
.../admin/executor/MySQLSetVariableAdminExecutorTest.java | 6 +++---
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutorTest.java
index 0831b2259dd..a9d11d82cce 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutorTest.java
@@ -25,7 +25,6 @@ import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryRes
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.parser.rule.SQLParserRule;
import
org.apache.shardingsphere.parser.rule.builder.DefaultSQLParserRuleConfigurationBuilder;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.io.BufferedReader;
@@ -37,6 +36,7 @@ import java.util.Objects;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
class ConvertYamlConfigurationExecutorTest {
@@ -95,12 +95,9 @@ class ConvertYamlConfigurationExecutorTest {
assertParseSQL((String) actual.getCell(1));
}
- private void assertParseSQL(final String actual) {
-
Splitter.on(";").trimResults().omitEmptyStrings().splitToList(actual).forEach(this::assertNotNull);
- }
-
- private void assertNotNull(final String sql) {
-
Assertions.assertNotNull(sqlParserRule.getSQLParserEngine(TypedSPILoader.getService(DatabaseType.class,
"MySQL")).parse(sql, false));
+ private void assertParseSQL(final String distSQLs) {
+ Splitter.on(";").trimResults().omitEmptyStrings().splitToList(distSQLs)
+ .forEach(each ->
assertNotNull(sqlParserRule.getSQLParserEngine(TypedSPILoader.getService(DatabaseType.class,
"MySQL")).parse(each, false)));
}
@SneakyThrows(IOException.class)
diff --git
a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSetVariableAdminExecutorTest.java
b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSetVariableAdminExecutorTest.java
index 3e8ed5709d6..e587c7801a4 100644
---
a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSetVariableAdminExecutorTest.java
+++
b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSetVariableAdminExecutorTest.java
@@ -37,7 +37,6 @@ import
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.SetStatemen
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLSetStatement;
import org.apache.shardingsphere.test.mock.AutoMockExtension;
import org.apache.shardingsphere.test.mock.StaticMockSettings;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.MockedConstruction;
@@ -48,6 +47,7 @@ import java.util.Collections;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mockConstruction;
@@ -109,7 +109,7 @@ class MySQLSetVariableAdminExecutorTest {
SetStatement setStatement = new MySQLSetStatement();
setStatement.getVariableAssigns().add(unknownVariableAssignSegment);
MySQLSetVariableAdminExecutor executor = new
MySQLSetVariableAdminExecutor(setStatement);
- Assertions.assertThrows(UnknownSystemVariableException.class, () ->
executor.execute(mock(ConnectionSession.class)));
+ assertThrows(UnknownSystemVariableException.class, () ->
executor.execute(mock(ConnectionSession.class)));
}
@Test
@@ -120,6 +120,6 @@ class MySQLSetVariableAdminExecutorTest {
SetStatement setStatement = new MySQLSetStatement();
setStatement.getVariableAssigns().add(variableAssignSegment);
MySQLSetVariableAdminExecutor executor = new
MySQLSetVariableAdminExecutor(setStatement);
- Assertions.assertThrows(ErrorGlobalVariableException.class, () ->
executor.execute(mock(ConnectionSession.class)));
+ assertThrows(ErrorGlobalVariableException.class, () ->
executor.execute(mock(ConnectionSession.class)));
}
}