This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 1843173ca94 Enforce static imports for Matchers and Assertions on
CheckStyle (#38286)
1843173ca94 is described below
commit 1843173ca9426332f5f6128bd9eb5a1469f0c797
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Mar 1 17:31:05 2026 +0800
Enforce static imports for Matchers and Assertions on CheckStyle (#38286)
---
.../GenericTableRandomReplaceAlgorithmTest.java | 9 +++----
.../sql/process/lock/ProcessOperationLockTest.java | 4 +--
.../CircuitBreakerPreparedStatementTest.java | 5 ++--
.../ParameterMarkerExpressionConverterTest.java | 8 ++----
.../rule/GlobalConfigurationManagerTest.java | 3 ++-
.../statement/PostgreSQLStatementVisitorTest.java | 7 ++---
src/resources/checkstyle.xml | 7 ++++-
.../type/DorisCreateRepositoryStatementAssert.java | 23 +++++++++--------
.../type/DorisDescFunctionStatementAssert.java | 14 +++++-----
.../type/DorisDropRepositoryStatementAssert.java | 5 ++--
.../type/DorisShowFunctionsStatementAssert.java | 19 +++++++-------
.../doris/type/DorisShowProcStatementAssert.java | 5 ++--
.../type/ShowAlterTableStatementAssert.java | 30 ++++++++++++----------
.../doris/DorisDropFunctionStatementAssert.java | 19 +++++++-------
.../doris/DorisPauseSyncJobStatementAssert.java | 5 ++--
.../doris/DorisResumeSyncJobStatementAssert.java | 5 ++--
.../DorisAlterRoutineLoadStatementAssert.java | 7 ++---
.../DorisCreateRoutineLoadStatementAssert.java | 7 ++---
18 files changed, 97 insertions(+), 85 deletions(-)
diff --git
a/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/replace/GenericTableRandomReplaceAlgorithmTest.java
b/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/replace/GenericTableRandomReplaceAlgorithmTest.java
index cbb29706df2..184f176ad9a 100644
---
a/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/replace/GenericTableRandomReplaceAlgorithmTest.java
+++
b/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/replace/GenericTableRandomReplaceAlgorithmTest.java
@@ -21,7 +21,6 @@ import
org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
-import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
@@ -52,9 +51,9 @@ class GenericTableRandomReplaceAlgorithmTest {
void assertMaskWithEmptyProps() {
GenericTableRandomReplaceAlgorithm maskAlgorithm =
(GenericTableRandomReplaceAlgorithm)
TypedSPILoader.getService(MaskAlgorithm.class, "GENERIC_TABLE_RANDOM_REPLACE",
new Properties());
assertNull(maskAlgorithm.mask(null));
- assertThat(maskAlgorithm.mask("Ab1!").substring(0, 1),
anyOf(Arrays.stream("ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")).map(Matchers::is).collect(Collectors.toList())));
- assertThat(maskAlgorithm.mask("Ab1!").substring(1, 2),
anyOf(Arrays.stream("abcdefghijklmnopqrstuvwxyz".split("")).map(Matchers::is).collect(Collectors.toList())));
- assertThat(maskAlgorithm.mask("Ab1!").substring(2, 3),
anyOf(Arrays.stream("0123456789".split("")).map(Matchers::is).collect(Collectors.toList())));
- assertThat(maskAlgorithm.mask("Ab1!").substring(3, 4),
anyOf(Arrays.stream("~!@#$%^&*:<>|".split("")).map(Matchers::is).collect(Collectors.toList())));
+ assertThat(maskAlgorithm.mask("Ab1!").substring(0, 1),
anyOf(Arrays.stream("ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")).map(each ->
is(each)).collect(Collectors.toList())));
+ assertThat(maskAlgorithm.mask("Ab1!").substring(1, 2),
anyOf(Arrays.stream("abcdefghijklmnopqrstuvwxyz".split("")).map(each ->
is(each)).collect(Collectors.toList())));
+ assertThat(maskAlgorithm.mask("Ab1!").substring(2, 3),
anyOf(Arrays.stream("0123456789".split("")).map(each ->
is(each)).collect(Collectors.toList())));
+ assertThat(maskAlgorithm.mask("Ab1!").substring(3, 4),
anyOf(Arrays.stream("~!@#$%^&*:<>|".split("")).map(each ->
is(each)).collect(Collectors.toList())));
}
}
diff --git
a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/lock/ProcessOperationLockTest.java
b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/lock/ProcessOperationLockTest.java
index 57736a2bb1f..aacb37e9f0b 100644
---
a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/lock/ProcessOperationLockTest.java
+++
b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/lock/ProcessOperationLockTest.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.infra.executor.sql.process.lock;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.time.Duration;
import java.util.concurrent.atomic.AtomicBoolean;
+import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
import static org.junit.jupiter.api.Assertions.assertTrue;
class ProcessOperationLockTest {
@@ -39,7 +39,7 @@ class ProcessOperationLockTest {
Thread awaitingThread = new Thread(() ->
result.set(lock.awaitDefaultTime(() -> false)));
awaitingThread.start();
lock.doNotify();
- Assertions.assertTimeoutPreemptively(Duration.ofSeconds(1), () ->
awaitingThread.join());
+ assertTimeoutPreemptively(Duration.ofSeconds(1), () ->
awaitingThread.join());
assertTrue(result.get());
}
}
diff --git
a/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerPreparedStatementTest.java
b/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerPreparedStatementTest.java
index 5af2209b39a..6597585130c 100644
---
a/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerPreparedStatementTest.java
+++
b/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerPreparedStatementTest.java
@@ -19,7 +19,6 @@ package
org.apache.shardingsphere.driver.state.circuit.statement;
import
org.apache.shardingsphere.driver.state.circuit.connection.CircuitBreakerConnection;
import
org.apache.shardingsphere.driver.state.circuit.resultset.CircuitBreakerResultSet;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
@@ -297,12 +296,12 @@ class CircuitBreakerPreparedStatementTest {
@Test
void assertGetResultSetConcurrency() {
- Assertions.assertEquals(ResultSet.CONCUR_READ_ONLY, new
CircuitBreakerPreparedStatement().getResultSetConcurrency());
+ assertThat(new
CircuitBreakerPreparedStatement().getResultSetConcurrency(),
is(ResultSet.CONCUR_READ_ONLY));
}
@Test
void assertGetResultSetType() {
- Assertions.assertEquals(ResultSet.TYPE_FORWARD_ONLY, new
CircuitBreakerPreparedStatement().getResultSetType());
+ assertThat(new CircuitBreakerPreparedStatement().getResultSetType(),
is(ResultSet.TYPE_FORWARD_ONLY));
}
@Test
diff --git
a/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/ParameterMarkerExpressionConverterTest.java
b/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/ParameterMarkerExpressionConverterTest.java
index 1add16bb482..d15f4116a40 100644
---
a/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/ParameterMarkerExpressionConverterTest.java
+++
b/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/ParameterMarkerExpressionConverterTest.java
@@ -18,20 +18,16 @@
package
org.apache.shardingsphere.sqlfederation.compiler.sql.ast.converter.segment.expression.impl;
import org.apache.calcite.sql.SqlDynamicParam;
-import org.apache.calcite.sql.SqlNode;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
class ParameterMarkerExpressionConverterTest {
@Test
void assertConvertParameterMarker() {
- SqlNode actual = ParameterMarkerExpressionConverter.convert(new
ParameterMarkerExpressionSegment(0, 0, 5));
- Assertions.assertInstanceOf(SqlDynamicParam.class, actual);
- assertThat(((SqlDynamicParam) actual).getIndex(), is(5));
+ assertThat(((SqlDynamicParam)
ParameterMarkerExpressionConverter.convert(new
ParameterMarkerExpressionSegment(0, 0, 5))).getIndex(), is(5));
}
}
diff --git
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/GlobalConfigurationManagerTest.java
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/GlobalConfigurationManagerTest.java
index 52cc9865ab0..afdcc8fbf5b 100644
---
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/GlobalConfigurationManagerTest.java
+++
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/GlobalConfigurationManagerTest.java
@@ -47,6 +47,7 @@ import java.util.LinkedList;
import java.util.Properties;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -104,7 +105,7 @@ class GlobalConfigurationManagerTest {
ShardingSphereRule builtRule = mock(ShardingSphereRule.class);
when(GlobalRulesBuilder.buildSingleRules(eq(newConfig), any(),
any(ConfigurationProperties.class))).thenReturn(Collections.singleton(builtRule));
new GlobalConfigurationManager(metaDataContexts,
mock(MetaDataPersistFacade.class)).alterGlobalRuleConfiguration(newConfig);
-
org.junit.jupiter.api.Assertions.assertFalse(metaDataContexts.getMetaData().getGlobalRuleMetaData().getRules().contains(nonClosableAssignableRule));
+
assertFalse(metaDataContexts.getMetaData().getGlobalRuleMetaData().getRules().contains(nonClosableAssignableRule));
assertTrue(metaDataContexts.getMetaData().getGlobalRuleMetaData().getRules().contains(builtRule));
}
diff --git
a/parser/sql/engine/dialect/postgresql/src/test/java/org/apache/shardingsphere/sql/parser/engine/postgresql/visitor/statement/PostgreSQLStatementVisitorTest.java
b/parser/sql/engine/dialect/postgresql/src/test/java/org/apache/shardingsphere/sql/parser/engine/postgresql/visitor/statement/PostgreSQLStatementVisitorTest.java
index 98de69063d0..a845ff5d2c3 100644
---
a/parser/sql/engine/dialect/postgresql/src/test/java/org/apache/shardingsphere/sql/parser/engine/postgresql/visitor/statement/PostgreSQLStatementVisitorTest.java
+++
b/parser/sql/engine/dialect/postgresql/src/test/java/org/apache/shardingsphere/sql/parser/engine/postgresql/visitor/statement/PostgreSQLStatementVisitorTest.java
@@ -24,13 +24,14 @@ import
org.apache.shardingsphere.sql.parser.engine.core.ParseASTNode;
import
org.apache.shardingsphere.sql.parser.statement.core.extractor.TableExtractor;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.NotExpression;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement;
-import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.util.Collection;
import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasItems;
+import static org.hamcrest.Matchers.isA;
import static org.junit.jupiter.api.Assertions.assertTrue;
class PostgreSQLStatementVisitorTest {
@@ -42,11 +43,11 @@ class PostgreSQLStatementVisitorTest {
ParseASTNode parseASTNode = new SQLParserEngine("PostgreSQL", new
CacheOption(128, 1024L)).parse(sql, false);
SelectStatement statement = (SelectStatement) new
SQLStatementVisitorEngine("PostgreSQL").visit(parseASTNode);
assertTrue(statement.getWhere().isPresent());
- assertThat(statement.getWhere().get().getExpr(),
Matchers.instanceOf(NotExpression.class));
+ assertThat(statement.getWhere().get().getExpr(),
isA(NotExpression.class));
TableExtractor tableExtractor = new TableExtractor();
tableExtractor.extractTablesFromSelect(statement);
Collection<String> rewriteTableNames =
tableExtractor.getRewriteTables().stream()
.map(each ->
each.getTableName().getIdentifier().getValue()).collect(Collectors.toList());
- assertThat(rewriteTableNames, Matchers.hasItems("t17", "t23", "t22"));
+ assertThat(rewriteTableNames, hasItems("t17", "t23", "t22"));
}
}
diff --git a/src/resources/checkstyle.xml b/src/resources/checkstyle.xml
index 76ced07bcd9..566e04540fe 100644
--- a/src/resources/checkstyle.xml
+++ b/src/resources/checkstyle.xml
@@ -153,7 +153,12 @@
<!-- Imports -->
<module name="AvoidStarImport" />
<module name="AvoidStaticImport">
- <property name="excludes"
value="org.junit.jupiter.api.Assertions.assertTrue,org.junit.jupiter.api.Assertions.assertFalse,org.junit.jupiter.api.Assertions.assertNull,org.junit.jupiter.api.Assertions.assertNotNull,org.junit.jupiter.api.Assertions.assertArrayEquals,org.junit.jupiter.api.Assertions.assertThrows,org.junit.jupiter.api.Assertions.assertDoesNotThrow,org.junit.jupiter.api.Assertions.assertTimeout,org.junit.jupiter.api.Assertions.fail,org.junit.jupiter.api.Assumptions
[...]
+ <property name="excludes"
value="org.junit.jupiter.api.Assertions.assertTrue,org.junit.jupiter.api.Assertions.assertFalse,org.junit.jupiter.api.Assertions.assertNull,org.junit.jupiter.api.Assertions.assertNotNull,org.junit.jupiter.api.Assertions.assertArrayEquals,org.junit.jupiter.api.Assertions.assertThrows,org.junit.jupiter.api.Assertions.assertDoesNotThrow,org.junit.jupiter.api.Assertions.assertTimeout,org.junit.jupiter.api.Assertions.assertTimeoutPreemptively,org.junit.ju
[...]
+ </module>
+ <module name="RegexpSinglelineJava">
+ <property name="format"
value="^\s*import\s+org\.(hamcrest\.Matchers|junit\.jupiter\.api\.Assertions)\s*;"
/>
+ <property name="ignoreComments" value="true" />
+ <property name="message" value="Use static import for
org.hamcrest.Matchers and org.junit.jupiter.api.Assertions." />
</module>
<module name="IllegalImport" />
<module name="RedundantImport" />
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCreateRepositoryStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCreateRepositoryStatementAssert.java
index eabcd9a81fd..b9dfcd9a2b3 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCreateRepositoryStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCreateRepositoryStatementAssert.java
@@ -26,9 +26,10 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQL
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.identifier.IdentifierValueAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCreateRepositoryStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.PropertyTestCase;
-import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.Assertions;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* Create repository statement assert for Doris.
@@ -52,12 +53,12 @@ public final class DorisCreateRepositoryStatementAssert {
}
private static void assertReadOnlyFlag(final SQLCaseAssertContext
assertContext, final DorisCreateRepositoryStatement actual, final
DorisCreateRepositoryStatementTestCase expected) {
- MatcherAssert.assertThat(assertContext.getText("read-only flag does
not match: "), actual.isReadOnly(), Matchers.is(expected.isReadOnly()));
+ assertThat(assertContext.getText("read-only flag does not match: "),
actual.isReadOnly(), is(expected.isReadOnly()));
}
private static void assertRepositoryName(final SQLCaseAssertContext
assertContext, final DorisCreateRepositoryStatement actual, final
DorisCreateRepositoryStatementTestCase expected) {
if (null != expected.getRepositoryName()) {
- Assertions.assertNotNull(actual.getRepositoryName(),
assertContext.getText("Actual repository name should exist."));
+ assertNotNull(actual.getRepositoryName(),
assertContext.getText("Actual repository name should exist."));
IdentifierValueAssert.assertIs(assertContext,
actual.getRepositoryName().getIdentifier(), expected.getRepositoryName(),
"Repository name");
SQLSegmentAssert.assertIs(assertContext,
actual.getRepositoryName(), expected.getRepositoryName());
}
@@ -65,20 +66,20 @@ public final class DorisCreateRepositoryStatementAssert {
private static void assertStorageType(final SQLCaseAssertContext
assertContext, final DorisCreateRepositoryStatement actual, final
DorisCreateRepositoryStatementTestCase expected) {
if (null != expected.getStorageType()) {
- MatcherAssert.assertThat(assertContext.getText("storage type does
not match: "), actual.getStorageType(), Matchers.is(expected.getStorageType()));
+ assertThat(assertContext.getText("storage type does not match: "),
actual.getStorageType(), is(expected.getStorageType()));
}
}
private static void assertLocation(final SQLCaseAssertContext
assertContext, final DorisCreateRepositoryStatement actual, final
DorisCreateRepositoryStatementTestCase expected) {
if (null != expected.getLocation()) {
- MatcherAssert.assertThat(assertContext.getText("location does not
match: "), actual.getLocation(), Matchers.is(expected.getLocation()));
+ assertThat(assertContext.getText("location does not match: "),
actual.getLocation(), is(expected.getLocation()));
}
}
private static void assertProperties(final SQLCaseAssertContext
assertContext, final DorisCreateRepositoryStatement actual, final
DorisCreateRepositoryStatementTestCase expected) {
- Assertions.assertNotNull(actual.getProperties(),
assertContext.getText("properties should not be null"));
+ assertNotNull(actual.getProperties(),
assertContext.getText("properties should not be null"));
if (!expected.getProperties().isEmpty()) {
- MatcherAssert.assertThat(assertContext.getText("Properties size
does not match: "), actual.getProperties().getProperties().size(),
Matchers.is(expected.getProperties().size()));
+ assertThat(assertContext.getText("Properties size does not match:
"), actual.getProperties().getProperties().size(),
is(expected.getProperties().size()));
for (int i = 0; i < expected.getProperties().size(); i++) {
assertProperty(assertContext,
actual.getProperties().getProperties().get(i), expected.getProperties().get(i));
}
@@ -86,8 +87,8 @@ public final class DorisCreateRepositoryStatementAssert {
}
private static void assertProperty(final SQLCaseAssertContext
assertContext, final PropertySegment actual, final PropertyTestCase expected) {
- MatcherAssert.assertThat(assertContext.getText(String.format("Property
key '%s' assertion error: ", expected.getKey())), actual.getKey(),
Matchers.is(expected.getKey()));
- MatcherAssert.assertThat(assertContext.getText(String.format("Property
value for key '%s' assertion error: ", expected.getKey())), actual.getValue(),
Matchers.is(expected.getValue()));
+ assertThat(assertContext.getText(String.format("Property key '%s'
assertion error: ", expected.getKey())), actual.getKey(),
is(expected.getKey()));
+ assertThat(assertContext.getText(String.format("Property value for key
'%s' assertion error: ", expected.getKey())), actual.getValue(),
is(expected.getValue()));
SQLSegmentAssert.assertIs(assertContext, actual, expected);
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisDescFunctionStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisDescFunctionStatementAssert.java
index eae7bfc1f7e..76df53a0af3 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisDescFunctionStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisDescFunctionStatementAssert.java
@@ -25,8 +25,10 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQL
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.owner.OwnerAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisDescFunctionStatementTestCase;
import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.Assertions;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Desc function statement assert for Doris.
@@ -47,14 +49,14 @@ public final class DorisDescFunctionStatementAssert {
private static void assertFunctionName(final SQLCaseAssertContext
assertContext, final DorisDescFunctionStatement actual, final
DorisDescFunctionStatementTestCase expected) {
if (null != expected.getFunctionName()) {
- Assertions.assertTrue(actual.getFunctionName().isPresent(),
assertContext.getText("Function name should not be null"));
+ assertTrue(actual.getFunctionName().isPresent(),
assertContext.getText("Function name should not be null"));
MatcherAssert.assertThat(assertContext.getText("Function name
assertion error: "), actual.getFunctionName().get().getIdentifier().getValue(),
- Matchers.is(expected.getFunctionName().getFunctionName()));
+ is(expected.getFunctionName().getFunctionName()));
SQLSegmentAssert.assertIs(assertContext,
actual.getFunctionName().get(), expected.getFunctionName());
if (null == expected.getFunctionName().getOwner()) {
-
Assertions.assertFalse(actual.getFunctionName().get().getOwner().isPresent(),
assertContext.getText("Actual function owner should not exist."));
+
assertFalse(actual.getFunctionName().get().getOwner().isPresent(),
assertContext.getText("Actual function owner should not exist."));
} else {
-
Assertions.assertTrue(actual.getFunctionName().get().getOwner().isPresent(),
assertContext.getText("Actual function owner should exist."));
+
assertTrue(actual.getFunctionName().get().getOwner().isPresent(),
assertContext.getText("Actual function owner should exist."));
OwnerAssert.assertIs(assertContext,
actual.getFunctionName().get().getOwner().get(),
expected.getFunctionName().getOwner());
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisDropRepositoryStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisDropRepositoryStatementAssert.java
index c9ba5bb32cc..6fdbbfd5903 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisDropRepositoryStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisDropRepositoryStatementAssert.java
@@ -24,7 +24,8 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAsse
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQLSegmentAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.identifier.IdentifierValueAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisDropRepositoryStatementTestCase;
-import org.junit.jupiter.api.Assertions;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* Drop repository statement assert for Doris.
@@ -41,7 +42,7 @@ public final class DorisDropRepositoryStatementAssert {
*/
public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisDropRepositoryStatement actual, final
DorisDropRepositoryStatementTestCase expected) {
if (null != expected.getRepositoryName()) {
- Assertions.assertNotNull(actual.getRepositoryName(),
assertContext.getText("Actual repository name should exist."));
+ assertNotNull(actual.getRepositoryName(),
assertContext.getText("Actual repository name should exist."));
IdentifierValueAssert.assertIs(assertContext,
actual.getRepositoryName().getIdentifier(), expected.getRepositoryName(),
"Repository name");
SQLSegmentAssert.assertIs(assertContext,
actual.getRepositoryName(), expected.getRepositoryName());
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowFunctionsStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowFunctionsStatementAssert.java
index a7fb0114470..d667ba1f099 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowFunctionsStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowFunctionsStatementAssert.java
@@ -24,9 +24,10 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAsse
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQLSegmentAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.database.DatabaseAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowFunctionsStatementTestCase;
-import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.Assertions;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Show functions statement assert for Doris.
@@ -51,25 +52,25 @@ public final class DorisShowFunctionsStatementAssert {
private static void assertGlobal(final SQLCaseAssertContext assertContext,
final DorisShowFunctionsStatement actual, final
DorisShowFunctionsStatementTestCase expected) {
if (null != expected.getGlobal()) {
- MatcherAssert.assertThat(assertContext.getText("Global flag
assertion error: "), actual.isGlobal(), Matchers.is(expected.getGlobal()));
+ assertThat(assertContext.getText("Global flag assertion error: "),
actual.isGlobal(), is(expected.getGlobal()));
}
}
private static void assertFull(final SQLCaseAssertContext assertContext,
final DorisShowFunctionsStatement actual, final
DorisShowFunctionsStatementTestCase expected) {
if (null != expected.getFull()) {
- MatcherAssert.assertThat(assertContext.getText("Full flag
assertion error: "), actual.isFull(), Matchers.is(expected.getFull()));
+ assertThat(assertContext.getText("Full flag assertion error: "),
actual.isFull(), is(expected.getFull()));
}
}
private static void assertBuiltin(final SQLCaseAssertContext
assertContext, final DorisShowFunctionsStatement actual, final
DorisShowFunctionsStatementTestCase expected) {
if (null != expected.getBuiltin()) {
- MatcherAssert.assertThat(assertContext.getText("Builtin flag
assertion error: "), actual.isBuiltin(), Matchers.is(expected.getBuiltin()));
+ assertThat(assertContext.getText("Builtin flag assertion error:
"), actual.isBuiltin(), is(expected.getBuiltin()));
}
}
private static void assertFromDatabase(final SQLCaseAssertContext
assertContext, final DorisShowFunctionsStatement actual, final
DorisShowFunctionsStatementTestCase expected) {
if (null != expected.getFromDatabase()) {
- Assertions.assertTrue(actual.getFromDatabase().isPresent(),
assertContext.getText("Actual from database should exist."));
+ assertTrue(actual.getFromDatabase().isPresent(),
assertContext.getText("Actual from database should exist."));
DatabaseAssert.assertIs(assertContext,
actual.getFromDatabase().get().getDatabase(),
expected.getFromDatabase().getDatabase());
SQLSegmentAssert.assertIs(assertContext,
actual.getFromDatabase().get(), expected.getFromDatabase());
}
@@ -77,8 +78,8 @@ public final class DorisShowFunctionsStatementAssert {
private static void assertLike(final SQLCaseAssertContext assertContext,
final DorisShowFunctionsStatement actual, final
DorisShowFunctionsStatementTestCase expected) {
if (null != expected.getLike()) {
- Assertions.assertTrue(actual.getLike().isPresent(),
assertContext.getText("Actual like segment should exist."));
- MatcherAssert.assertThat(assertContext.getText("Like pattern
assertion error: "), actual.getLike().get().getPattern(),
Matchers.is(expected.getLike().getPattern()));
+ assertTrue(actual.getLike().isPresent(),
assertContext.getText("Actual like segment should exist."));
+ assertThat(assertContext.getText("Like pattern assertion error:
"), actual.getLike().get().getPattern(), is(expected.getLike().getPattern()));
SQLSegmentAssert.assertIs(assertContext, actual.getLike().get(),
expected.getLike());
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowProcStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowProcStatementAssert.java
index 232780a0960..b52a41d7fa7 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowProcStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisShowProcStatementAssert.java
@@ -23,7 +23,8 @@ import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisShowProcSta
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowProcStatementTestCase;
import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
+
+import static org.hamcrest.Matchers.is;
/**
* Show proc statement assert for Doris.
@@ -39,6 +40,6 @@ public final class DorisShowProcStatementAssert {
* @param expected expected show proc statement test case
*/
public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisShowProcStatement actual, final DorisShowProcStatementTestCase
expected) {
- MatcherAssert.assertThat(assertContext.getText("Assertion error: proc
path does not match."), actual.getProcPath(),
Matchers.is(expected.getProcPath()));
+ MatcherAssert.assertThat(assertContext.getText("Assertion error: proc
path does not match."), actual.getProcPath(), is(expected.getProcPath()));
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/standard/type/ShowAlterTableStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/standard/type/ShowAlterTableStatementAssert.java
index 0554d51767b..e0abe8d9156 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/standard/type/ShowAlterTableStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/standard/type/ShowAlterTableStatementAssert.java
@@ -26,9 +26,11 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.lim
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.orderby.OrderByClauseAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.where.WhereClauseAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.ShowAlterTableStatementTestCase;
-import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.Assertions;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
/**
* Show alter table statement assert.
@@ -53,46 +55,46 @@ public final class ShowAlterTableStatementAssert {
private static void assertAlterType(final SQLCaseAssertContext
assertContext, final ShowAlterTableStatement actual, final
ShowAlterTableStatementTestCase expected) {
if (null != expected.getAlterType()) {
- Assertions.assertNotNull(actual.getAlterType().orElse(null),
assertContext.getText("Actual alter type should exist."));
- MatcherAssert.assertThat(assertContext.getText("Alter type
assertion error: "), actual.getAlterType().get(),
Matchers.is(expected.getAlterType()));
+ assertNotNull(actual.getAlterType().orElse(null),
assertContext.getText("Actual alter type should exist."));
+ assertThat(assertContext.getText("Alter type assertion error: "),
actual.getAlterType().get(), is(expected.getAlterType()));
} else {
- Assertions.assertNull(actual.getAlterType().orElse(null),
assertContext.getText("Actual alter type should not exist."));
+ assertNull(actual.getAlterType().orElse(null),
assertContext.getText("Actual alter type should not exist."));
}
}
private static void assertDatabase(final SQLCaseAssertContext
assertContext, final ShowAlterTableStatement actual, final
ShowAlterTableStatementTestCase expected) {
if (null != expected.getDatabase()) {
- Assertions.assertNotNull(actual.getDatabase().orElse(null),
assertContext.getText("Actual database should exist."));
+ assertNotNull(actual.getDatabase().orElse(null),
assertContext.getText("Actual database should exist."));
DatabaseAssert.assertIs(assertContext, actual.getDatabase().get(),
expected.getDatabase());
} else {
- Assertions.assertNull(actual.getDatabase().orElse(null),
assertContext.getText("Actual database should not exist."));
+ assertNull(actual.getDatabase().orElse(null),
assertContext.getText("Actual database should not exist."));
}
}
private static void assertWhere(final SQLCaseAssertContext assertContext,
final ShowAlterTableStatement actual, final ShowAlterTableStatementTestCase
expected) {
if (null != expected.getWhere()) {
- Assertions.assertNotNull(actual.getWhere().orElse(null),
assertContext.getText("Actual where segment should exist."));
+ assertNotNull(actual.getWhere().orElse(null),
assertContext.getText("Actual where segment should exist."));
WhereClauseAssert.assertIs(assertContext, actual.getWhere().get(),
expected.getWhere());
} else {
- Assertions.assertNull(actual.getWhere().orElse(null),
assertContext.getText("Actual where segment should not exist."));
+ assertNull(actual.getWhere().orElse(null),
assertContext.getText("Actual where segment should not exist."));
}
}
private static void assertOrderBy(final SQLCaseAssertContext
assertContext, final ShowAlterTableStatement actual, final
ShowAlterTableStatementTestCase expected) {
if (null != expected.getOrderBy()) {
- Assertions.assertNotNull(actual.getOrderBy().orElse(null),
assertContext.getText("Actual order by segment should exist."));
+ assertNotNull(actual.getOrderBy().orElse(null),
assertContext.getText("Actual order by segment should exist."));
OrderByClauseAssert.assertIs(assertContext,
actual.getOrderBy().get(), expected.getOrderBy());
} else {
- Assertions.assertNull(actual.getOrderBy().orElse(null),
assertContext.getText("Actual order by segment should not exist."));
+ assertNull(actual.getOrderBy().orElse(null),
assertContext.getText("Actual order by segment should not exist."));
}
}
private static void assertLimit(final SQLCaseAssertContext assertContext,
final ShowAlterTableStatement actual, final ShowAlterTableStatementTestCase
expected) {
if (null != expected.getLimit()) {
- Assertions.assertNotNull(actual.getLimit().orElse(null),
assertContext.getText("Actual limit segment should exist."));
+ assertNotNull(actual.getLimit().orElse(null),
assertContext.getText("Actual limit segment should exist."));
LimitClauseAssert.assertRowCount(assertContext,
actual.getLimit().get().getRowCount().orElse(null),
expected.getLimit().getRowCount());
} else {
- Assertions.assertNull(actual.getLimit().orElse(null),
assertContext.getText("Actual limit segment should not exist."));
+ assertNull(actual.getLimit().orElse(null),
assertContext.getText("Actual limit segment should not exist."));
}
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDropFunctionStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDropFunctionStatementAssert.java
index e1bafff62b1..745511547c7 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDropFunctionStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDropFunctionStatementAssert.java
@@ -25,12 +25,13 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAsse
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQLSegmentAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.type.ExpectedDataTypeSegment;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisDropFunctionStatementTestCase;
-import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
-import org.junit.jupiter.api.Assertions;
import java.util.List;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* Drop function statement assert for Doris.
*/
@@ -52,16 +53,15 @@ public final class DorisDropFunctionStatementAssert {
private static void assertFunctionName(final SQLCaseAssertContext
assertContext, final DorisDropFunctionStatement actual, final
DorisDropFunctionStatementTestCase expected) {
if (null != expected.getFunctionName()) {
- Assertions.assertTrue(actual.getFunctionName().isPresent(),
assertContext.getText("Function name should not be null"));
- MatcherAssert.assertThat(assertContext.getText("Function name
assertion error: "), actual.getFunctionName().get().getIdentifier().getValue(),
- Matchers.is(expected.getFunctionName().getName()));
+ assertTrue(actual.getFunctionName().isPresent(),
assertContext.getText("Function name should not be null"));
+ assertThat(assertContext.getText("Function name assertion error:
"), actual.getFunctionName().get().getIdentifier().getValue(),
is(expected.getFunctionName().getName()));
SQLSegmentAssert.assertIs(assertContext,
actual.getFunctionName().get(), expected.getFunctionName());
}
}
private static void assertGlobal(final SQLCaseAssertContext assertContext,
final DorisDropFunctionStatement actual, final
DorisDropFunctionStatementTestCase expected) {
if (null != expected.getGlobal()) {
- MatcherAssert.assertThat(assertContext.getText("Global flag
assertion error: "), actual.isGlobal(), Matchers.is(expected.getGlobal()));
+ assertThat(assertContext.getText("Global flag assertion error: "),
actual.isGlobal(), is(expected.getGlobal()));
}
}
@@ -69,10 +69,9 @@ public final class DorisDropFunctionStatementAssert {
if (!expected.getParameterDataTypes().isEmpty()) {
List<DataTypeSegment> actualParams =
actual.getParameterDataTypes();
List<ExpectedDataTypeSegment> expectedParams =
expected.getParameterDataTypes();
- MatcherAssert.assertThat(assertContext.getText("Parameter count
assertion error: "), actualParams.size(), Matchers.is(expectedParams.size()));
+ assertThat(assertContext.getText("Parameter count assertion error:
"), actualParams.size(), is(expectedParams.size()));
for (int i = 0; i < actualParams.size(); i++) {
-
MatcherAssert.assertThat(assertContext.getText(String.format("Parameter %d type
assertion error: ", i)), actualParams.get(i).getDataTypeName(),
- Matchers.is(expectedParams.get(i).getName()));
+ assertThat(assertContext.getText(String.format("Parameter %d
type assertion error: ", i)), actualParams.get(i).getDataTypeName(),
is(expectedParams.get(i).getName()));
}
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisPauseSyncJobStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisPauseSyncJobStatementAssert.java
index 5a69a00e9d8..dab8b676a28 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisPauseSyncJobStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisPauseSyncJobStatementAssert.java
@@ -24,7 +24,8 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAsse
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.owner.OwnerAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisPauseSyncJobStatementTestCase;
import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
+
+import static org.hamcrest.Matchers.is;
/**
* Pause sync job statement assert for Doris.
@@ -41,7 +42,7 @@ public final class DorisPauseSyncJobStatementAssert {
*/
public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisPauseSyncJobStatement actual, final
DorisPauseSyncJobStatementTestCase expected) {
if (actual.getJobName().isPresent()) {
- MatcherAssert.assertThat(assertContext.getText("Job name does not
match: "), actual.getJobName().get().getIdentifier().getValue(),
Matchers.is(expected.getJobName()));
+ MatcherAssert.assertThat(assertContext.getText("Job name does not
match: "), actual.getJobName().get().getIdentifier().getValue(),
is(expected.getJobName()));
if (null != expected.getOwner()) {
OwnerAssert.assertIs(assertContext,
actual.getJobName().get().getOwner().orElse(null), expected.getOwner());
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisResumeSyncJobStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisResumeSyncJobStatementAssert.java
index 9d903497a33..ef6db9f8bf6 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisResumeSyncJobStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisResumeSyncJobStatementAssert.java
@@ -24,7 +24,8 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAsse
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.owner.OwnerAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisResumeSyncJobStatementTestCase;
import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
+
+import static org.hamcrest.Matchers.is;
/**
* Resume sync job statement assert for Doris.
@@ -41,7 +42,7 @@ public final class DorisResumeSyncJobStatementAssert {
*/
public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisResumeSyncJobStatement actual, final
DorisResumeSyncJobStatementTestCase expected) {
if (actual.getJobName().isPresent()) {
- MatcherAssert.assertThat(assertContext.getText("Job name does not
match: "), actual.getJobName().get().getIdentifier().getValue(),
Matchers.is(expected.getJobName()));
+ MatcherAssert.assertThat(assertContext.getText("Job name does not
match: "), actual.getJobName().get().getIdentifier().getValue(),
is(expected.getJobName()));
if (null != expected.getOwner()) {
OwnerAssert.assertIs(assertContext,
actual.getJobName().get().getOwner().orElse(null), expected.getOwner());
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dml/dialect/doris/DorisAlterRoutineLoadStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dml/dialect/doris/DorisAlterRoutineLoadStatementAssert.java
index fc9946ebf04..55702a18860 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dml/dialect/doris/DorisAlterRoutineLoadStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dml/dialect/doris/DorisAlterRoutineLoadStatementAssert.java
@@ -28,7 +28,8 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dml.dialect.doris.DorisAlterRoutineLoadStatementTestCase;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
-import org.junit.jupiter.api.Assertions;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* Alter routine load statement assert for Doris.
@@ -61,7 +62,7 @@ public final class DorisAlterRoutineLoadStatementAssert {
private static void assertJobProperties(final SQLCaseAssertContext
assertContext, final DorisAlterRoutineLoadStatement actual, final
DorisAlterRoutineLoadStatementTestCase expected) {
if (actual.getJobProperties().isPresent() && null !=
expected.getJobProperties() && !expected.getJobProperties().isEmpty()) {
- Assertions.assertNotNull(actual.getJobProperties().get(),
assertContext.getText("Job properties should not be null"));
+ assertNotNull(actual.getJobProperties().get(),
assertContext.getText("Job properties should not be null"));
MatcherAssert.assertThat(assertContext.getText("Job properties
size does not match: "), actual.getJobProperties().get().getProperties().size(),
CoreMatchers.is(expected.getJobProperties().size()));
for (int i = 0; i < expected.getJobProperties().size(); i++) {
@@ -78,7 +79,7 @@ public final class DorisAlterRoutineLoadStatementAssert {
private static void assertDataSourceProperties(final SQLCaseAssertContext
assertContext, final DorisAlterRoutineLoadStatement actual, final
DorisAlterRoutineLoadStatementTestCase expected) {
if (actual.getDataSourceProperties().isPresent() && null !=
expected.getDataSourceProperties() &&
!expected.getDataSourceProperties().isEmpty()) {
- Assertions.assertNotNull(actual.getDataSourceProperties().get(),
assertContext.getText("Data source properties should not be null"));
+ assertNotNull(actual.getDataSourceProperties().get(),
assertContext.getText("Data source properties should not be null"));
MatcherAssert.assertThat(assertContext.getText("Data source
properties size does not match: "),
actual.getDataSourceProperties().get().getProperties().size(),
CoreMatchers.is(expected.getDataSourceProperties().size()));
for (int i = 0; i < expected.getDataSourceProperties().size();
i++) {
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dml/dialect/doris/DorisCreateRoutineLoadStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dml/dialect/doris/DorisCreateRoutineLoadStatementAssert.java
index 6494b29dc78..ae6a05c0bb4 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dml/dialect/doris/DorisCreateRoutineLoadStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dml/dialect/doris/DorisCreateRoutineLoadStatementAssert.java
@@ -37,7 +37,8 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dml.dialect.doris.DorisCreateRoutineLoadStatementTestCase;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
-import org.junit.jupiter.api.Assertions;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* Create routine load statement assert for Doris.
@@ -152,7 +153,7 @@ public final class DorisCreateRoutineLoadStatementAssert {
private static void assertJobProperties(final SQLCaseAssertContext
assertContext, final DorisCreateRoutineLoadStatement actual, final
DorisCreateRoutineLoadStatementTestCase expected) {
if (actual.getJobProperties().isPresent() && null !=
expected.getJobProperties() && !expected.getJobProperties().isEmpty()) {
- Assertions.assertNotNull(actual.getJobProperties().get(),
assertContext.getText("Job properties should not be null"));
+ assertNotNull(actual.getJobProperties().get(),
assertContext.getText("Job properties should not be null"));
MatcherAssert.assertThat(assertContext.getText("Job properties
size does not match: "), actual.getJobProperties().get().getProperties().size(),
CoreMatchers.is(expected.getJobProperties().size()));
for (int i = 0; i < expected.getJobProperties().size(); i++) {
@@ -169,7 +170,7 @@ public final class DorisCreateRoutineLoadStatementAssert {
private static void assertDataSourceProperties(final SQLCaseAssertContext
assertContext, final DorisCreateRoutineLoadStatement actual, final
DorisCreateRoutineLoadStatementTestCase expected) {
if (actual.getDataSourceProperties().isPresent() && null !=
expected.getDataSourceProperties() &&
!expected.getDataSourceProperties().isEmpty()) {
- Assertions.assertNotNull(actual.getDataSourceProperties().get(),
assertContext.getText("Data source properties should not be null"));
+ assertNotNull(actual.getDataSourceProperties().get(),
assertContext.getText("Data source properties should not be null"));
MatcherAssert.assertThat(assertContext.getText("Data source
properties size does not match: "),
actual.getDataSourceProperties().get().getProperties().size(),
CoreMatchers.is(expected.getDataSourceProperties().size()));
for (int i = 0; i < expected.getDataSourceProperties().size();
i++) {