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 7f5fa8895a9 Add checkstyle rule to avoid use assertThat and
is(true/false) (#38071)
7f5fa8895a9 is described below
commit 7f5fa8895a94ba4262d70f20a643862158f3b3a6
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Feb 17 22:43:56 2026 +0800
Add checkstyle rule to avoid use assertThat and is(true/false) (#38071)
* Update release notes
* Add checkstyle rule to avoid use assertThat and is(true/false)
---
.../common/FirebirdCommonInfoPacketTypeTest.java | 6 ++---
.../FirebirdDatabaseInfoPacketTypeTest.java | 3 ++-
.../type/sql/FirebirdSQLInfoPacketTypeTest.java | 3 ++-
.../FirebirdExecuteStatementPacketTest.java | 3 ++-
.../expression/type/InExpressionBinderTest.java | 3 ++-
.../infra/datanode/DataNodeTest.java | 2 +-
.../infra/datanode/DataNodeUtilsTest.java | 13 +++++------
.../metadata/database/schema/HashColumnTest.java | 5 +++--
.../utils/RowStatisticsCollectorUtilsTest.java | 3 ++-
.../YamlDataSourceConfigurationSwapperTest.java | 2 +-
.../resultset/CircuitBreakerResultSetTest.java | 9 ++++----
.../CircuitBreakerPreparedStatementTest.java | 5 +++--
.../statement/CircuitBreakerStatementTest.java | 19 ++++++++--------
.../wal/decode/TestDecodingPluginTest.java | 3 ++-
.../PostgreSQLColumnPropertiesAppenderTest.java | 7 +++---
.../ddl/index/PostgreSQLIndexSQLGeneratorTest.java | 26 ++++++++++++----------
.../table/PostgreSQLTablePropertiesLoaderTest.java | 5 +++--
.../impl/LiteralExpressionConverterTest.java | 2 +-
.../resource/ResourceSwitchManagerTest.java | 9 ++++----
.../ClusterExclusiveOperatorContextTest.java | 5 ++---
.../standalone/memory/MemoryRepositoryTest.java | 9 ++++----
.../show/MySQLShowProcessListExecutorTest.java | 12 +++++-----
.../netty/FrontendChannelInboundHandlerTest.java | 6 ++---
.../FirebirdCancelBlobCommandExecutorTest.java | 7 +++---
.../PostgreSQLAuthenticationEngineTest.java | 5 +++--
.../PostgreSQLCommandExecuteEngineTest.java | 5 +++--
.../PostgreSQLComDescribeExecutorTest.java | 3 ++-
src/resources/checkstyle.xml | 4 ++++
.../segment/assignment/RowAliasSegmentAssert.java | 12 +++++-----
.../asserts/segment/catalog/CatalogAssert.java | 3 ++-
.../segment/outfile/OutfileClauseAssert.java | 11 ++++-----
.../InventoryColumnValueReaderEngineTest.java | 3 ++-
.../api/ConsistencyCheckJobAPITest.java | 6 ++---
.../commons/repository/OrderItemRepository.java | 8 +++----
.../test/natived/jdbc/databases/DorisFETest.java | 7 +++---
35 files changed, 129 insertions(+), 105 deletions(-)
diff --git
a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketTypeTest.java
b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketTypeTest.java
index dd32730eb05..47cfeb9b618 100644
---
a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketTypeTest.java
+++
b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketTypeTest.java
@@ -27,6 +27,7 @@ import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.verify;
@ExtendWith(MockitoExtension.class)
@@ -37,8 +38,7 @@ class FirebirdCommonInfoPacketTypeTest {
@Test
void assertValueOf() {
-
assertThat(FirebirdCommonInfoPacketType.valueOf(FirebirdCommonInfoPacketType.END.getCode()),
- is(FirebirdCommonInfoPacketType.END));
+
assertThat(FirebirdCommonInfoPacketType.valueOf(FirebirdCommonInfoPacketType.END.getCode()),
is(FirebirdCommonInfoPacketType.END));
}
@Test
@@ -54,6 +54,6 @@ class FirebirdCommonInfoPacketTypeTest {
@Test
void assertIsCommon() {
- assertThat(FirebirdCommonInfoPacketType.DATA_NOT_READY.isCommon(),
is(true));
+ assertTrue(FirebirdCommonInfoPacketType.DATA_NOT_READY.isCommon());
}
}
diff --git
a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoPacketTypeTest.java
b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoPacketTypeTest.java
index 308dac71997..591d064acb0 100644
---
a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoPacketTypeTest.java
+++
b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoPacketTypeTest.java
@@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
class FirebirdDatabaseInfoPacketTypeTest {
@@ -32,6 +33,6 @@ class FirebirdDatabaseInfoPacketTypeTest {
@Test
void assertIsCommon() {
- assertThat(FirebirdDatabaseInfoPacketType.DB_SIZE_IN_PAGES.isCommon(),
is(false));
+
assertFalse(FirebirdDatabaseInfoPacketType.DB_SIZE_IN_PAGES.isCommon());
}
}
diff --git
a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoPacketTypeTest.java
b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoPacketTypeTest.java
index 67f49f7d907..54f0f671bf4 100644
---
a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoPacketTypeTest.java
+++
b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoPacketTypeTest.java
@@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
class FirebirdSQLInfoPacketTypeTest {
@@ -32,6 +33,6 @@ class FirebirdSQLInfoPacketTypeTest {
@Test
void assertIsCommon() {
- assertThat(FirebirdSQLInfoPacketType.TYPE.isCommon(), is(false));
+ assertFalse(FirebirdSQLInfoPacketType.TYPE.isCommon());
}
}
diff --git
a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/execute/FirebirdExecuteStatementPacketTest.java
b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/execute/FirebirdExecuteStatementPacketTest.java
index 230c3a58af7..a88e31bd71f 100644
---
a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/execute/FirebirdExecuteStatementPacketTest.java
+++
b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/execute/FirebirdExecuteStatementPacketTest.java
@@ -32,6 +32,7 @@ import java.util.Collections;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
@@ -79,7 +80,7 @@ class FirebirdExecuteStatementPacketTest {
when(returnBlr.skipBytes(anyInt())).thenReturn(returnBlr);
when(payload.readInt4Unsigned()).thenReturn(30L, 1L, 1024L);
FirebirdExecuteStatementPacket packet = new
FirebirdExecuteStatementPacket(payload,
FirebirdProtocolVersion.PROTOCOL_VERSION19);
- assertThat(packet.isStoredProcedure(), is(true));
+ assertTrue(packet.isStoredProcedure());
assertThat(packet.getReturnColumns(),
is(Collections.singletonList(FirebirdBinaryColumnType.LONG)));
assertThat(packet.getOutputMessageNumber(), is(9));
assertThat(packet.getParameterValues(),
is(Collections.singletonList(123)));
diff --git
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/InExpressionBinderTest.java
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/InExpressionBinderTest.java
index c1953d5fddb..053df394175 100644
---
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/InExpressionBinderTest.java
+++
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/InExpressionBinderTest.java
@@ -33,6 +33,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -57,6 +58,6 @@ class InExpressionBinderTest {
assertThat(actual.getStopIndex(), is(10));
assertThat(actual.getLeft(), is(boundLeftSegment));
assertThat(actual.getRight(), is(boundRightSegment));
- assertThat(actual.isNot(), is(true));
+ assertTrue(actual.isNot());
}
}
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java
index d55f03122ed..c96930950d6 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java
@@ -71,7 +71,7 @@ class DataNodeTest {
assertThat(dataNode, is(new DataNode("ds_0.tbl_0")));
assertThat(dataNode, is(new DataNode("DS_0.TBL_0")));
assertThat(dataNode, not(new DataNode("ds_0.tbl_1")));
- assertThat(dataNode.equals("ds.tbl"), is(false));
+ assertFalse(dataNode.equals("ds.tbl"));
assertFalse(dataNode.equals(null));
}
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeUtilsTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeUtilsTest.java
index b40c7f61b0e..cc2ae4c09f1 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeUtilsTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeUtilsTest.java
@@ -27,9 +27,12 @@ import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.NoSuchElementException;
-import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
class DataNodeUtilsTest {
@@ -93,7 +96,7 @@ class DataNodeUtilsTest {
void assertGetFormattedDataNodesWithZeroAmount() {
List<String> actual = DataNodeUtils.getFormattedDataNodes(0,
"t_order", Arrays.asList("ds_0", "ds_1"));
assertThat(actual.size(), is(0));
- assertThat(actual.isEmpty(), is(true));
+ assertTrue(actual.isEmpty());
}
@Test
@@ -123,11 +126,7 @@ class DataNodeUtilsTest {
@Test
void assertGetFormattedDataNodesWithEmptyDataSources() {
- try {
- DataNodeUtils.getFormattedDataNodes(1, "t_order",
Collections.emptyList());
- } catch (final java.util.NoSuchElementException ex) {
- assertThat(true, is(true));
- }
+ assertThrows(NoSuchElementException.class, () ->
DataNodeUtils.getFormattedDataNodes(1, "t_order", Collections.emptyList()));
}
@Test
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/HashColumnTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/HashColumnTest.java
index 0768d586ea8..1635ac5f9f0 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/HashColumnTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/HashColumnTest.java
@@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
class HashColumnTest {
@@ -33,8 +34,8 @@ class HashColumnTest {
assertThat(new HashColumn("col", "tbl", false), not(new
HashColumn("col", "tbl1", false)));
HashColumn column1 = new HashColumn("col", "tbl", false);
HashColumn column2 = new HashColumn("COL", "TBL", false);
- assertThat(column1.equals(column2), is(true));
- assertThat(column2.equals(column1), is(true));
+ assertTrue(column1.equals(column2));
+ assertTrue(column2.equals(column1));
}
@Test
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/statistics/utils/RowStatisticsCollectorUtilsTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/statistics/utils/RowStatisticsCollectorUtilsTest.java
index b4409048dbe..aaeb02a0ee6 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/statistics/utils/RowStatisticsCollectorUtilsTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/statistics/utils/RowStatisticsCollectorUtilsTest.java
@@ -32,6 +32,7 @@ import java.util.Map;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
class RowStatisticsCollectorUtilsTest {
@@ -48,7 +49,7 @@ class RowStatisticsCollectorUtilsTest {
assertThat(actual.get(5), is(100));
assertThat(actual.get(6), is(25));
assertThat(actual.get(7), is(3.14f));
- assertThat(actual.get(8), is(true));
+ assertTrue((boolean) actual.get(8));
assertNull(actual.get(9));
}
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourceConfigurationSwapperTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourceConfigurationSwapperTest.java
index ed27daef196..ce7bc21d47c 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourceConfigurationSwapperTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourceConfigurationSwapperTest.java
@@ -115,7 +115,7 @@ class YamlDataSourceConfigurationSwapperTest {
yamlConfig.put("password", "");
DataSourcePoolProperties actual =
swapper.swapToDataSourcePoolProperties(yamlConfig);
assertThat(actual.getPoolClassName(),
is("com.zaxxer.hikari.HikariDataSource"));
-
assertThat(actual.getAllLocalProperties().containsKey("dataSourceClassName"),
is(false));
+
assertFalse(actual.getAllLocalProperties().containsKey("dataSourceClassName"));
assertThat(actual.getAllLocalProperties().get("url").toString(),
is("jdbc:h2:mem:test"));
assertThat(actual.getAllLocalProperties().get("username").toString(),
is("sa"));
}
diff --git
a/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/resultset/CircuitBreakerResultSetTest.java
b/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/resultset/CircuitBreakerResultSetTest.java
index edbc441d3f7..0688dd846f1 100644
---
a/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/resultset/CircuitBreakerResultSetTest.java
+++
b/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/resultset/CircuitBreakerResultSetTest.java
@@ -28,13 +28,14 @@ import static org.hamcrest.Matchers.isA;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
@SuppressWarnings("resource")
class CircuitBreakerResultSetTest {
@Test
void assertNext() {
- assertThat(new CircuitBreakerResultSet().next(), is(false));
+ assertFalse(new CircuitBreakerResultSet().next());
}
@Test
@@ -44,7 +45,7 @@ class CircuitBreakerResultSetTest {
@Test
void assertWasNull() {
- assertThat(new CircuitBreakerResultSet().wasNull(), is(true));
+ assertTrue(new CircuitBreakerResultSet().wasNull());
}
@Test
@@ -69,12 +70,12 @@ class CircuitBreakerResultSetTest {
@Test
void assertGetBooleanByIndex() {
- assertThat(new CircuitBreakerResultSet().getBoolean(1), is(false));
+ assertFalse(new CircuitBreakerResultSet().getBoolean(1));
}
@Test
void assertGetBooleanByLabel() {
- assertThat(new CircuitBreakerResultSet().getBoolean("foo"), is(false));
+ assertFalse(new CircuitBreakerResultSet().getBoolean("foo"));
}
@Test
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 212b441829c..5af2209b39a 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
@@ -39,6 +39,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isA;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
@SuppressWarnings("resource")
@@ -191,7 +192,7 @@ class CircuitBreakerPreparedStatementTest {
@Test
void assertExecute() {
- assertThat(new CircuitBreakerPreparedStatement().execute(), is(false));
+ assertFalse(new CircuitBreakerPreparedStatement().execute());
}
@Test
@@ -306,7 +307,7 @@ class CircuitBreakerPreparedStatementTest {
@Test
void assertIsAccumulate() {
- assertThat(new CircuitBreakerPreparedStatement().isAccumulate(),
is(false));
+ assertFalse(new CircuitBreakerPreparedStatement().isAccumulate());
}
@Test
diff --git
a/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerStatementTest.java
b/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerStatementTest.java
index e6c02860a1f..91bdcc44b6f 100644
---
a/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerStatementTest.java
+++
b/jdbc/src/test/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerStatementTest.java
@@ -27,6 +27,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isA;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
@SuppressWarnings("resource")
@@ -149,12 +150,12 @@ class CircuitBreakerStatementTest {
@Test
void assertGetMoreResultsWithoutParam() {
- assertThat(new CircuitBreakerStatement().getMoreResults(), is(false));
+ assertFalse(new CircuitBreakerStatement().getMoreResults());
}
@Test
void assertGetMoreResultsWithParam() {
- assertThat(new
CircuitBreakerStatement().getMoreResults(Statement.CLOSE_CURRENT_RESULT),
is(false));
+ assertFalse(new
CircuitBreakerStatement().getMoreResults(Statement.CLOSE_CURRENT_RESULT));
}
@Test
@@ -189,22 +190,22 @@ class CircuitBreakerStatementTest {
@Test
void assertExecute() {
- assertThat(new CircuitBreakerStatement().execute("sql"), is(false));
+ assertFalse(new CircuitBreakerStatement().execute("sql"));
}
@Test
void assertExecuteWithAutoGeneratedKeys() {
- assertThat(new CircuitBreakerStatement().execute("sql",
Statement.NO_GENERATED_KEYS), is(false));
+ assertFalse(new CircuitBreakerStatement().execute("sql",
Statement.NO_GENERATED_KEYS));
}
@Test
void assertExecuteWithColumnIndexes() {
- assertThat(new CircuitBreakerStatement().execute("sql", new int[]{0}),
is(false));
+ assertFalse(new CircuitBreakerStatement().execute("sql", new
int[]{0}));
}
@Test
void assertExecuteWithColumnNames() {
- assertThat(new CircuitBreakerStatement().execute("sql", new
String[]{""}), is(false));
+ assertFalse(new CircuitBreakerStatement().execute("sql", new
String[]{""}));
}
@Test
@@ -214,7 +215,7 @@ class CircuitBreakerStatementTest {
@Test
void assertIsClosed() {
- assertThat(new CircuitBreakerStatement().isClosed(), is(false));
+ assertFalse(new CircuitBreakerStatement().isClosed());
}
@Test
@@ -224,7 +225,7 @@ class CircuitBreakerStatementTest {
@Test
void assertIsPoolable() {
- assertThat(new CircuitBreakerStatement().isPoolable(), is(false));
+ assertFalse(new CircuitBreakerStatement().isPoolable());
}
@Test
@@ -234,7 +235,7 @@ class CircuitBreakerStatementTest {
@Test
void assertIsCloseOnCompletion() {
- assertThat(new CircuitBreakerStatement().isCloseOnCompletion(),
is(false));
+ assertFalse(new CircuitBreakerStatement().isCloseOnCompletion());
}
@Test
diff --git
a/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/incremental/wal/decode/TestDecodingPluginTest.java
b/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/incremental/wal/decode/TestDecodingPluginTest.java
index c00d7854373..75173b1295c 100644
---
a/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/incremental/wal/decode/TestDecodingPluginTest.java
+++
b/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/incremental/wal/decode/TestDecodingPluginTest.java
@@ -48,6 +48,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.isA;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -189,7 +190,7 @@ class TestDecodingPluginTest {
assertThat(actual.getAfterRow().get(3), is(1234567890123L));
assertThat(actual.getAfterRow().get(4), is(1.5F));
assertThat(actual.getAfterRow().get(5), is(2.5D));
- assertThat(actual.getAfterRow().get(6), is(true));
+ assertTrue((boolean) actual.getAfterRow().get(6));
assertThat(actual.getAfterRow().get(7),
is(Date.valueOf("2020-01-02")));
assertThat(actual.getAfterRow().get(8), is(Time.valueOf("12:34:56")));
assertThat(actual.getAfterRow().get(9),
is(Timestamp.valueOf("2020-01-02 03:04:05")));
diff --git
a/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/column/PostgreSQLColumnPropertiesAppenderTest.java
b/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/column/PostgreSQLColumnPropertiesAppenderTest.java
index a6456ec289a..314bb7cf7ff 100644
---
a/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/column/PostgreSQLColumnPropertiesAppenderTest.java
+++
b/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/column/PostgreSQLColumnPropertiesAppenderTest.java
@@ -42,6 +42,7 @@ import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.anyMap;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
@@ -129,8 +130,8 @@ class PostgreSQLColumnPropertiesAppenderTest {
when(templateExecutor.executeByTemplate(anyMap(),
eq("component/columns/%s/edit_mode_types_multi.ftl"))).thenReturn(Collections.emptyList());
appender.append(context);
Map<String, Object> singleColumn = getSingleColumn(context);
- assertThat(singleColumn.get("is_pk"), is(false));
- assertThat(singleColumn.get("is_primary_key"), is(false));
+ assertFalse((boolean) singleColumn.get("is_pk"));
+ assertFalse((boolean) singleColumn.get("is_primary_key"));
}
@Test
@@ -873,7 +874,7 @@ class PostgreSQLColumnPropertiesAppenderTest {
assertThat(actualColumn.get("inheritedfromtype"), is("parent"));
assertThat(actualColumn.get("attlen"), is("5"));
assertThat(actualColumn.get("attprecision"), is("2"));
- assertThat(actualColumn.get("is_pk"), is(true));
+ assertTrue((boolean) actualColumn.get("is_pk"));
assertThat(actualColumn.get("cltype"), is("numeric"));
assertThat((Collection<?>) actualColumn.get("edit_types"),
contains("alpha", "numeric(5,2)"));
}
diff --git
a/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/index/PostgreSQLIndexSQLGeneratorTest.java
b/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/index/PostgreSQLIndexSQLGeneratorTest.java
index a4d70a8b94d..f18a3b0e3d7 100644
---
a/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/index/PostgreSQLIndexSQLGeneratorTest.java
+++
b/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/index/PostgreSQLIndexSQLGeneratorTest.java
@@ -36,6 +36,8 @@ import java.util.concurrent.atomic.AtomicReference;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyMap;
import static org.mockito.ArgumentMatchers.anyString;
@@ -158,23 +160,23 @@ class PostgreSQLIndexSQLGeneratorTest {
Collection<Map<String, Object>> columns = (Collection<Map<String,
Object>>) createData.get("columns");
assertThat(columns.size(), is(6));
Map<String, Object> columnWithNullOptions = columns.iterator().next();
- assertThat(columnWithNullOptions.get("sort_order"), is(false));
- assertThat(columnWithNullOptions.get("nulls"), is(false));
+ assertFalse((boolean) columnWithNullOptions.get("sort_order"));
+ assertFalse((boolean) columnWithNullOptions.get("nulls"));
Map<String, Object> descColumn = columns.stream().filter(each ->
"desc_col".equals(each.get("colname"))).findFirst().orElseGet(HashMap::new);
- assertThat(descColumn.get("sort_order"), is(true));
- assertThat(descColumn.get("nulls"), is(false));
+ assertTrue((boolean) descColumn.get("sort_order"));
+ assertFalse((boolean) descColumn.get("nulls"));
Map<String, Object> nullsFirstColumn = columns.stream().filter(each ->
"nulls_first_col".equals(each.get("colname"))).findFirst().orElseGet(HashMap::new);
- assertThat(nullsFirstColumn.get("sort_order"), is(false));
- assertThat(nullsFirstColumn.get("nulls"), is(true));
+ assertFalse((boolean) nullsFirstColumn.get("sort_order"));
+ assertTrue((boolean) nullsFirstColumn.get("nulls"));
Map<String, Object> nullsLastColumn = columns.stream().filter(each ->
"nulls_last_col".equals(each.get("colname"))).findFirst().orElseGet(HashMap::new);
- assertThat(nullsLastColumn.get("sort_order"), is(false));
- assertThat(nullsLastColumn.get("nulls"), is(false));
+ assertFalse((boolean) nullsLastColumn.get("sort_order"));
+ assertFalse((boolean) nullsLastColumn.get("nulls"));
Map<String, Object> nullsNoSpaceColumn = columns.stream().filter(each
->
"nulls_no_space_col".equals(each.get("colname"))).findFirst().orElseGet(HashMap::new);
- assertThat(nullsNoSpaceColumn.get("sort_order"), is(false));
- assertThat(nullsNoSpaceColumn.get("nulls"), is(false));
+ assertFalse((boolean) nullsNoSpaceColumn.get("sort_order"));
+ assertFalse((boolean) nullsNoSpaceColumn.get("nulls"));
Map<String, Object> emptyArrayColumn = columns.stream().filter(each ->
"empty_array_col".equals(each.get("colname"))).findFirst().orElseGet(HashMap::new);
- assertThat(emptyArrayColumn.get("sort_order"), is(false));
- assertThat(emptyArrayColumn.get("nulls"), is(false));
+ assertFalse((boolean) emptyArrayColumn.get("sort_order"));
+ assertFalse((boolean) emptyArrayColumn.get("nulls"));
String columnsCsv = (String) createData.get("columns_csv");
assertThat(columnsCsv, is("col_with_null_options, desc_col DESC,
nulls_first_col ASC NULLS FIRST, nulls_last_col ASC NULLS LAST,
nulls_no_space_col ASC NULLS, empty_array_col"));
}
diff --git
a/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/table/PostgreSQLTablePropertiesLoaderTest.java
b/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/table/PostgreSQLTablePropertiesLoaderTest.java
index 59293112563..72a68ffe151 100644
---
a/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/table/PostgreSQLTablePropertiesLoaderTest.java
+++
b/kernel/data-pipeline/dialect/postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/ddl/table/PostgreSQLTablePropertiesLoaderTest.java
@@ -26,6 +26,7 @@ import java.util.Map;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -49,8 +50,8 @@ class PostgreSQLTablePropertiesLoaderTest {
assertThat(actual.get("scid"), is(20));
assertThat(actual.get("autovacuum_enabled"), is("x"));
assertThat(actual.get("toast_autovacuum_enabled"), is("x"));
- assertThat(actual.get("autovacuum_custom"), is(false));
- assertThat(actual.get("toast_autovacuum"), is(false));
+ assertFalse((boolean) actual.get("autovacuum_custom"));
+ assertFalse((boolean) actual.get("toast_autovacuum"));
}
private ResultSet mockFetchDatabaseIdResultSet() throws SQLException {
diff --git
a/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/LiteralExpressionConverterTest.java
b/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/LiteralExpressionConverterTest.java
index 04f69dd1132..07739dc1db0 100644
---
a/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/LiteralExpressionConverterTest.java
+++
b/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/LiteralExpressionConverterTest.java
@@ -100,7 +100,7 @@ class LiteralExpressionConverterTest {
void assertConvertBooleanLiteral() {
SqlLiteral actual = (SqlLiteral)
LiteralExpressionConverter.convert(new LiteralExpressionSegment(0, 0, true),
null).orElse(null);
assertNotNull(actual);
- assertThat(actual.getValueAs(Boolean.class), is(true));
+ assertTrue(actual.getValueAs(Boolean.class));
}
@Test
diff --git
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/resource/ResourceSwitchManagerTest.java
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/resource/ResourceSwitchManagerTest.java
index 3c0e49a4e07..da01b6799d0 100644
---
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/resource/ResourceSwitchManagerTest.java
+++
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/resource/ResourceSwitchManagerTest.java
@@ -46,6 +46,7 @@ import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
@@ -182,7 +183,7 @@ class ResourceSwitchManagerTest {
SwitchingResource actual =
resourceSwitchManager.switchByRegisterStorageUnit(resourceMetaData,
toBeRegistered, false);
assertThat(actual.getNewDataSources(), aMapWithSize(0));
assertThat(actual.getStaleDataSources(), aMapWithSize(0));
- assertThat(actual.getStaleStorageUnitNames().isEmpty(), is(true));
+ assertTrue(actual.getStaleStorageUnitNames().isEmpty());
assertThat(actual.getMergedDataSourcePoolPropertiesMap(),
hasKey("ds_existing"));
}
@@ -196,7 +197,7 @@ class ResourceSwitchManagerTest {
SwitchingResource actual =
resourceSwitchManager.switchByAlterStorageUnit(resourceMetaData, toBeAltered,
false);
assertThat(actual.getNewDataSources().size(), is(1));
assertThat(actual.getStaleDataSources().size(), is(1));
- assertThat(actual.getStaleStorageUnitNames().isEmpty(), is(false));
+ assertFalse(actual.getStaleStorageUnitNames().isEmpty());
assertThat(actual.getMergedDataSourcePoolPropertiesMap(),
hasKey("ds_existing"));
}
}
@@ -206,7 +207,7 @@ class ResourceSwitchManagerTest {
ResourceMetaData resourceMetaData =
createResourceMetaDataWithSingleUnit("ds_existing");
SwitchingResource actual =
resourceSwitchManager.switchByUnregisterStorageUnit(resourceMetaData,
Collections.emptySet());
assertThat(actual.getStaleDataSources(), aMapWithSize(0));
- assertThat(actual.getStaleStorageUnitNames().isEmpty(), is(true));
+ assertTrue(actual.getStaleStorageUnitNames().isEmpty());
assertThat(actual.getMergedDataSourcePoolPropertiesMap(),
hasKey("ds_existing"));
}
@@ -215,7 +216,7 @@ class ResourceSwitchManagerTest {
ResourceMetaData resourceMetaData =
createResourceMetaDataWithSingleUnit("ds_existing");
SwitchingResource actual =
resourceSwitchManager.createByUnregisterStorageUnit(resourceMetaData,
Collections.emptySet());
assertThat(actual.getStaleDataSources(), aMapWithSize(0));
- assertThat(actual.getStaleStorageUnitNames().isEmpty(), is(true));
+ assertTrue(actual.getStaleStorageUnitNames().isEmpty());
assertThat(actual.getMergedDataSourcePoolPropertiesMap(),
hasKey("ds_existing"));
}
diff --git
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/exclusive/ClusterExclusiveOperatorContextTest.java
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/exclusive/ClusterExclusiveOperatorContextTest.java
index 5ef7002570b..f375e6d3ce8 100644
---
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/exclusive/ClusterExclusiveOperatorContextTest.java
+++
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/exclusive/ClusterExclusiveOperatorContextTest.java
@@ -26,8 +26,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -45,7 +44,7 @@ class ClusterExclusiveOperatorContextTest {
void assertStartTryLock() {
when(DistributedLockHolder.getDistributedLock("op",
repository)).thenReturn(distributedLock);
when(distributedLock.tryLock(50L)).thenReturn(true);
- assertThat(new ClusterExclusiveOperatorContext(repository).start("op",
50L), is(true));
+ assertTrue(new ClusterExclusiveOperatorContext(repository).start("op",
50L));
verify(distributedLock).tryLock(50L);
}
diff --git
a/mode/type/standalone/repository/provider/memory/src/test/java/org/apache/shardingsphere/mode/repository/standalone/memory/MemoryRepositoryTest.java
b/mode/type/standalone/repository/provider/memory/src/test/java/org/apache/shardingsphere/mode/repository/standalone/memory/MemoryRepositoryTest.java
index 8a0fc65fd2e..de8a9b03731 100644
---
a/mode/type/standalone/repository/provider/memory/src/test/java/org/apache/shardingsphere/mode/repository/standalone/memory/MemoryRepositoryTest.java
+++
b/mode/type/standalone/repository/provider/memory/src/test/java/org/apache/shardingsphere/mode/repository/standalone/memory/MemoryRepositoryTest.java
@@ -24,6 +24,8 @@ import java.util.Arrays;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
class MemoryRepositoryTest {
@@ -46,21 +48,20 @@ class MemoryRepositoryTest {
@Test
void assertUpdate() {
memoryRepository.update("/metadata/sharding_db/schemas/sharding_db/tables/t_order/versions/0",
"t_order_updated");
-
assertThat(memoryRepository.query("/metadata/sharding_db/schemas/sharding_db/tables/t_order/versions/0"),
- is("t_order_updated"));
+
assertThat(memoryRepository.query("/metadata/sharding_db/schemas/sharding_db/tables/t_order/versions/0"),
is("t_order_updated"));
}
@Test
void assertDelete() {
memoryRepository.delete("/metadata/sharding_db/schemas/sharding_db/tables/t_order/versions/0");
-
assertThat(memoryRepository.isExisted("/metadata/sharding_db/schemas/sharding_db/tables/t_order/versions/0"),
is(false));
+
assertFalse(memoryRepository.isExisted("/metadata/sharding_db/schemas/sharding_db/tables/t_order/versions/0"));
assertThat(memoryRepository.query("/metadata/sharding_db/schemas/sharding_db/tables/t_order/versions/0"),
is((String) null));
}
@Test
void assertGetChildrenKeys() {
assertThat(memoryRepository.getChildrenKeys("/metadata").size(),
is(2));
-
assertThat(memoryRepository.getChildrenKeys("/metadata").containsAll(Arrays.asList("encrypt_db",
"sharding_db")), is(true));
+
assertTrue(memoryRepository.getChildrenKeys("/metadata").containsAll(Arrays.asList("encrypt_db",
"sharding_db")));
assertThat(memoryRepository.getChildrenKeys("/metadata/sharding_db/schemas/sharding_db/tables/").size(),
is(2));
assertThat(memoryRepository.getChildrenKeys("/metadata/encrypt_db/schemas/encrypt_db/tables/").size(),
is(2));
}
diff --git
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/show/MySQLShowProcessListExecutorTest.java
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/show/MySQLShowProcessListExecutorTest.java
index c1132445bb5..9324fa4fd7b 100644
---
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/show/MySQLShowProcessListExecutorTest.java
+++
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/show/MySQLShowProcessListExecutorTest.java
@@ -40,6 +40,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.startsWith;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -86,18 +88,18 @@ class MySQLShowProcessListExecutorTest {
showProcessListExecutor.execute(new ConnectionSession(databaseType,
new DefaultAttributeMap()), mock());
MergedResult mergedResult = showProcessListExecutor.getMergedResult();
int rowCount = 0;
- assertThat(mergedResult.next(), is(true));
+ assertTrue(mergedResult.next());
rowCount++;
assertThat(mergedResult.getValue(5, String.class), is("Sleep"));
assertThat(mergedResult.getValue(7, String.class), is(""));
assertThat(mergedResult.getValue(8, String.class), is(""));
- assertThat(mergedResult.next(), is(true));
+ assertTrue(mergedResult.next());
rowCount++;
assertThat(mergedResult.getValue(5, String.class), is("Execute"));
assertThat(mergedResult.getValue(7, String.class), is("Executing
2/4"));
assertThat(((String) mergedResult.getValue(8, String.class)).length(),
is(100));
assertThat((String) mergedResult.getValue(8, String.class),
startsWith(longSql.substring(0, 50)));
- assertThat(mergedResult.next(), is(false));
+ assertFalse(mergedResult.next());
assertThat(rowCount, is(2));
}
@@ -112,8 +114,8 @@ class MySQLShowProcessListExecutorTest {
MySQLShowProcessListExecutor executor = new
MySQLShowProcessListExecutor(new MySQLShowProcessListStatement(databaseType,
true));
executor.execute(new ConnectionSession(databaseType, new
DefaultAttributeMap()), mock());
MergedResult mergedResult = executor.getMergedResult();
- assertThat(mergedResult.next(), is(true));
+ assertTrue(mergedResult.next());
assertThat(((String) mergedResult.getValue(8, String.class)).length(),
is(120));
- assertThat(mergedResult.next(), is(false));
+ assertFalse(mergedResult.next());
}
}
diff --git
a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandlerTest.java
b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandlerTest.java
index 063169d1111..87bca9ce096 100644
---
a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandlerTest.java
+++
b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandlerTest.java
@@ -71,6 +71,7 @@ import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.doThrow;
@@ -275,7 +276,7 @@ class FrontendChannelInboundHandlerTest {
ProcessRegistry processRegistry = mock(ProcessRegistry.class);
when(ProcessRegistry.getInstance()).thenReturn(processRegistry);
channel.pipeline().fireUserEventTriggered(IdleStateEvent.ALL_IDLE_STATE_EVENT);
- assertThat(channel.isOpen(), is(false));
+ assertFalse(channel.isOpen());
}
@Test
@@ -286,10 +287,9 @@ class FrontendChannelInboundHandlerTest {
String processId = "foo_id";
connectionSession.setProcessId(processId);
Process process = mock(Process.class);
- when(process.isIdle()).thenReturn(false);
when(processRegistry.get(processId)).thenReturn(process);
channel.pipeline().fireUserEventTriggered(IdleStateEvent.ALL_IDLE_STATE_EVENT);
- assertThat(channel.isOpen(), is(true));
+ assertTrue(channel.isOpen());
}
@SneakyThrows(ReflectiveOperationException.class)
diff --git
a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCancelBlobCommandExecutorTest.java
b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCancelBlobCommandExecutorTest.java
index ecf62ad69b3..6813bee09a5 100644
---
a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCancelBlobCommandExecutorTest.java
+++
b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCancelBlobCommandExecutorTest.java
@@ -33,11 +33,11 @@ import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.util.Collection;
-import java.util.OptionalLong;
-import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isA;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
@@ -76,7 +76,6 @@ class FirebirdCancelBlobCommandExecutorTest {
DatabasePacket response = actual.iterator().next();
assertThat(response, isA(FirebirdGenericResponsePacket.class));
assertThat(((FirebirdGenericResponsePacket) response).getHandle(),
is(1));
- OptionalLong actualBlobId =
FirebirdBlobUploadCache.getInstance().getBlobId(CONNECTION_ID, blobHandle);
- assertThat(actualBlobId.isPresent(), is(false));
+
assertFalse(FirebirdBlobUploadCache.getInstance().getBlobId(CONNECTION_ID,
blobHandle).isPresent());
}
}
diff --git
a/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
b/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
index 9984235fa51..58329757ff8 100644
---
a/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
+++
b/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
@@ -83,6 +83,7 @@ import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
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;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
@@ -269,7 +270,7 @@ class PostgreSQLAuthenticationEngineTest {
AuthenticationResult actual =
authenticationEngine.authenticate(channelHandlerContext, passwordPayload);
verify(channelHandlerContext).write(any(PostgreSQLAuthenticationOKPacket.class));
verify(channelHandlerContext).writeAndFlush(PostgreSQLReadyForQueryPacket.NOT_IN_TRANSACTION);
- assertThat(actual.isFinished(), is(true));
+ assertTrue(actual.isFinished());
}
@Test
@@ -285,7 +286,7 @@ class PostgreSQLAuthenticationEngineTest {
AuthenticationResult actual =
authenticationEngine.authenticate(channelHandlerContext, passwordPayload);
verify(channelHandlerContext).write(any(PostgreSQLAuthenticationOKPacket.class));
verify(channelHandlerContext).writeAndFlush(PostgreSQLReadyForQueryPacket.NOT_IN_TRANSACTION);
- assertThat(actual.isFinished(), is(true));
+ assertTrue(actual.isFinished());
}
private ByteBuf createByteBuf(final int initialCapacity, final int
maxCapacity) {
diff --git
a/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngineTest.java
b/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngineTest.java
index ffcfb04c410..1ff9cb54714 100644
---
a/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngineTest.java
+++
b/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngineTest.java
@@ -64,6 +64,7 @@ import java.util.Optional;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
@@ -156,14 +157,14 @@ class PostgreSQLCommandExecuteEngineTest {
void assertGetOtherPacketWhenInTransaction() {
transactionStatus.setInTransaction(true);
Optional<DatabasePacket> actual =
commandExecuteEngine.getOtherPacket(connectionSession);
- assertThat(actual.isPresent(), is(true));
+ assertTrue(actual.isPresent());
assertThat(actual.get(),
is(PostgreSQLReadyForQueryPacket.TRANSACTION_FAILED));
}
@Test
void assertGetOtherPacketWhenNotInTransaction() {
Optional<DatabasePacket> actual =
commandExecuteEngine.getOtherPacket(connectionSession);
- assertThat(actual.isPresent(), is(true));
+ assertTrue(actual.isPresent());
assertThat(actual.get(),
is(PostgreSQLReadyForQueryPacket.NOT_IN_TRANSACTION));
}
diff --git
a/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
b/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
index 1675158780f..e01f6dee237 100644
---
a/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
+++
b/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
@@ -92,6 +92,7 @@ import java.util.stream.Stream;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.isA;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -212,7 +213,7 @@ class PostgreSQLComDescribeExecutorTest {
PostgreSQLPacketPayload mockPayload =
mock(PostgreSQLPacketPayload.class);
parameterDescription.write(mockPayload);
verify(mockPayload).writeInt2(0);
- assertThat(actualIterator.hasNext(), is(false));
+ assertFalse(actualIterator.hasNext());
}
@Test
diff --git a/src/resources/checkstyle.xml b/src/resources/checkstyle.xml
index 668500dad1a..c6eb20efd2c 100644
--- a/src/resources/checkstyle.xml
+++ b/src/resources/checkstyle.xml
@@ -110,6 +110,10 @@
<property name="format"
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"
/>
<property name="message" value="Consider using special escape
sequence instead of octal value or Unicode escaped value." />
</module>
+ <module name="MatchXpath">
+ <property name="query"
value="//METHOD_CALL[(./IDENT[@text='assertThat'] or
./DOT/IDENT[@text='assertThat']) and
./ELIST/EXPR[last()]/METHOD_CALL[(./IDENT[@text='is'] or
./DOT/IDENT[@text='is']) and ./ELIST/EXPR/*[self::LITERAL_TRUE or
self::LITERAL_FALSE]]]" />
+ <message key="matchxpath.match" value="Use assertTrue/assertFalse
instead of assertThat(..., is(true/false))." />
+ </module>
<module name="IllegalType" />
<module name="MissingSwitchDefault" />
<module name="ModifiedControlVariable" />
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/assignment/RowAliasSegmentAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/assignment/RowAliasSegmentAssert.java
index 9abe3bc6ce7..f4a50881d73 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/assignment/RowAliasSegmentAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/assignment/RowAliasSegmentAssert.java
@@ -27,6 +27,8 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Row alias segment assert.
@@ -43,9 +45,10 @@ public final class RowAliasSegmentAssert {
*/
public static void assertIs(final SQLCaseAssertContext assertContext,
final RowAliasSegment actual, final ExpectedRowAlias expected) {
assertThat(assertContext.getText("Row alias name assertion error: "),
actual.getAlias().getIdentifier().getValue(), is(expected.getAlias()));
- if (null != expected.getDerivedColumns() &&
!expected.getDerivedColumns().isEmpty()) {
- assertThat(assertContext.getText("Row alias derived columns size
assertion error: "),
- actual.getDerivedColumns().isPresent(), is(true));
+ if (expected.getDerivedColumns().isEmpty()) {
+ assertFalse(actual.getDerivedColumns().isPresent(),
assertContext.getText("Row alias derived columns assertion error: "));
+ } else {
+ assertTrue(actual.getDerivedColumns().isPresent(),
assertContext.getText("Row alias derived columns size assertion error: "));
assertThat(assertContext.getText("Row alias derived columns size
assertion error: "),
actual.getDerivedColumns().get().size(),
is(expected.getDerivedColumns().size()));
int count = 0;
@@ -53,9 +56,6 @@ public final class RowAliasSegmentAssert {
ColumnAssert.assertIs(assertContext, each,
expected.getDerivedColumns().get(count));
count++;
}
- } else {
- assertThat(assertContext.getText("Row alias derived columns
assertion error: "),
- actual.getDerivedColumns().isPresent(), is(false));
}
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/catalog/CatalogAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/catalog/CatalogAssert.java
index b74c20805de..f107cc7bbf7 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/catalog/CatalogAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/catalog/CatalogAssert.java
@@ -30,6 +30,7 @@ import java.util.Map;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Catalog assert.
@@ -74,7 +75,7 @@ public final class CatalogAssert {
}
private static void assertProperty(final SQLCaseAssertContext
assertContext, final Map<String, String> actual, final ExpectedCatalogProperty
expected) {
- assertThat(assertContext.getText(String.format("Property key '%s'
assertion error: ", expected.getKey())), actual.containsKey(expected.getKey()),
is(true));
+ assertTrue(actual.containsKey(expected.getKey()),
assertContext.getText(String.format("Property key '%s' assertion error: ",
expected.getKey())));
assertThat(assertContext.getText(String.format("Property value '%s'
assertion error: ", expected.getKey())), actual.get(expected.getKey()),
is(expected.getValue()));
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/outfile/OutfileClauseAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/outfile/OutfileClauseAssert.java
index 3b01efa4d2d..5309071454e 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/outfile/OutfileClauseAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/outfile/OutfileClauseAssert.java
@@ -25,11 +25,13 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQL
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.outfile.ExpectedOutfileClause;
import java.util.Map;
+import java.util.Map.Entry;
-import static org.hamcrest.Matchers.is;
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;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Outfile clause assert.
@@ -67,14 +69,13 @@ public final class OutfileClauseAssert {
private static void assertProperties(final SQLCaseAssertContext
assertContext, final Map<String, String> actual, final Map<String, String>
expected) {
if (null == expected || expected.isEmpty()) {
if (null != actual && !actual.isEmpty()) {
- assertThat(assertContext.getText("Actual outfile properties
should be empty."), actual.isEmpty(), is(true));
+ fail(assertContext.getText("Actual outfile properties should
be empty."));
}
} else {
assertNotNull(actual, assertContext.getText("Actual outfile
properties should exist."));
assertThat(assertContext.getText("Outfile properties size
assertion error: "), actual.size(), is(expected.size()));
- for (Map.Entry<String, String> entry : expected.entrySet()) {
- assertThat(assertContext.getText(String.format("Outfile
property '%s' assertion error: ", entry.getKey())),
- actual.get(entry.getKey()), is(entry.getValue()));
+ for (Entry<String, String> entry : expected.entrySet()) {
+ assertThat(assertContext.getText(String.format("Outfile
property '%s' assertion error: ", entry.getKey())), actual.get(entry.getKey()),
is(entry.getValue()));
}
}
}
diff --git
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/inventory/column/InventoryColumnValueReaderEngineTest.java
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/inventory/column/InventoryColumnValueReaderEngineTest.java
index 61558c9c798..84bafb6084a 100644
---
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/inventory/column/InventoryColumnValueReaderEngineTest.java
+++
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/inventory/column/InventoryColumnValueReaderEngineTest.java
@@ -44,6 +44,7 @@ import java.util.Optional;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -73,7 +74,7 @@ class InventoryColumnValueReaderEngineTest {
void assertReadWithBooleanValue() throws SQLException {
when(metaData.getColumnType(1)).thenReturn(Types.BOOLEAN);
when(resultSet.getBoolean(1)).thenReturn(true);
- assertThat(engine.read(resultSet, metaData, 1), is(true));
+ assertTrue((boolean) engine.read(resultSet, metaData, 1));
}
@Test
diff --git
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/ConsistencyCheckJobAPITest.java
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/ConsistencyCheckJobAPITest.java
index 48734f88994..99c746d3263 100644
---
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/ConsistencyCheckJobAPITest.java
+++
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/ConsistencyCheckJobAPITest.java
@@ -55,6 +55,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
@@ -227,12 +228,11 @@ class ConsistencyCheckJobAPITest {
void assertFinishedJobProgress() {
MigrationJobConfiguration parentJobConfig =
jobConfigSwapper.swapToObject(JobConfigurationBuilder.createYamlMigrationJobConfiguration());
String parentJobId = parentJobConfig.getJobId();
- String checkJobId = jobAPI.start(new
CreateConsistencyCheckJobParameter(parentJobId, null, null,
- parentJobConfig.getSourceDatabaseType(),
parentJobConfig.getTargetDatabaseType()));
+ String checkJobId = jobAPI.start(new
CreateConsistencyCheckJobParameter(parentJobId, null, null,
parentJobConfig.getSourceDatabaseType(),
parentJobConfig.getTargetDatabaseType()));
persistCheckJobProgress(createFinishedCheckJobItemProgress(),
checkJobId, JobStatus.FINISHED, 1000);
persistCheckJobResult(parentJobId, checkJobId);
ConsistencyCheckJobItemInfo actual =
jobAPI.getJobItemInfo(parentJobId);
- assertThat(actual.getCheckSuccess(), is(true));
+ assertTrue(actual.getCheckSuccess());
assertThat(actual.getCheckFailedTableNames(), is(""));
assertThat(actual.getIgnoredTableNames(), is(""));
assertThat(actual.getInventoryFinishedPercentage(), is(100));
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderItemRepository.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderItemRepository.java
index c174da7ca27..2795d60d8e1 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderItemRepository.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderItemRepository.java
@@ -29,8 +29,8 @@ import java.sql.Statement;
import java.util.LinkedList;
import java.util.List;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
@RequiredArgsConstructor
@SuppressWarnings({"SqlDialectInspection", "SqlNoDataSourceInspection"})
@@ -373,7 +373,7 @@ public final class OrderItemRepository {
}
try (Connection conn = dataSource.getConnection()) {
ResultSet resultSet = conn.createStatement().executeQuery("SELECT
* FROM t_order_item WHERE user_id = 2024");
- assertThat(resultSet.next(), is(false));
+ assertFalse(resultSet.next());
}
try (Connection conn = dataSource.getConnection()) {
try {
@@ -388,7 +388,7 @@ public final class OrderItemRepository {
}
try (Connection conn = dataSource.getConnection()) {
ResultSet resultSet = conn.createStatement().executeQuery("SELECT
* FROM t_order_item WHERE user_id = 2025");
- assertThat(resultSet.next(), is(true));
+ assertTrue(resultSet.next());
}
}
}
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/DorisFETest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/DorisFETest.java
index f0831491758..683043567c6 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/DorisFETest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/DorisFETest.java
@@ -38,9 +38,8 @@ import java.sql.Statement;
import java.time.Duration;
import java.util.stream.Stream;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
@EnabledInNativeImage
@Testcontainers
@@ -96,8 +95,8 @@ class DorisFETest {
private DataSource createDataSource() throws SQLException {
Awaitility.await().atMost(Duration.ofMinutes(1L)).ignoreExceptions().until(()
-> {
try (Connection connection =
DriverManager.getConnection(jdbcUrlPrefix, "root", null)) {
- assertThat(connection.createStatement().executeQuery("SELECT
`host`, `join`, `alive` FROM frontends()").next(), is(true));
- assertThat(connection.createStatement().executeQuery("SELECT
`host`, `alive` FROM backends()").next(), is(true));
+ assertTrue(connection.createStatement().executeQuery("SELECT
`host`, `join`, `alive` FROM frontends()").next());
+ assertTrue(connection.createStatement().executeQuery("SELECT
`host`, `alive` FROM backends()").next());
}
return true;
});