This is an automated email from the ASF dual-hosted git repository.
menghaoran 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 a2a0336 Use assertTrue(xxx.isEmpty()) to instead of
assertThat(xxx.size(), is(0)) (#11531)
a2a0336 is described below
commit a2a03362cd71d2e11d4067f9215ca2bd344b5a5d
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Jul 27 13:57:46 2021 +0800
Use assertTrue(xxx.isEmpty()) to instead of assertThat(xxx.size(), is(0))
(#11531)
---
.../advice/CommandExecutorTaskAdviceTest.java | 2 +-
.../advice/JDBCExecutorCallbackAdviceTest.java | 3 ++-
.../jaeger/advice/SQLParserEngineAdviceTest.java | 2 +-
.../advice/CommandExecutorTaskAdviceTest.java | 2 +-
.../advice/JDBCExecutorCallbackAdviceTest.java | 3 ++-
.../advice/SQLParserEngineAdviceTest.java | 2 +-
.../PostgreSQLBinaryStatementRegistryTest.java | 3 ++-
...orithmProviderConfigurationYamlSwapperTest.java | 5 ++--
.../builder/dialect/MySQLPrivilegeHandlerTest.java | 5 ++--
.../dialect/OraclePrivilegeHandlerTest.java | 4 ++--
.../dialect/SQLServerPrivilegeHandlerTest.java | 6 ++---
.../statement/impl/InsertStatementContextTest.java | 2 +-
.../metadata/schema/builder/SchemaBuilderTest.java | 8 +++----
.../yaml/schema/swapper/SchemaYamlSwapperTest.java | 8 +++----
.../infra/executor/kernel/ExecutorEngineTest.java | 3 ++-
.../engine/jdbc/JDBCExecutorCallbackTest.java | 3 ++-
.../channel/distribution/ManualBitSetTest.java | 4 ++--
.../common/datasource/DataSourceManagerTest.java | 3 ++-
.../netty/MySQLBinlogEventPacketDecoderTest.java | 7 +++---
.../asserts/segment/distsql/PropertiesAssert.java | 5 ++--
.../xa/XAShardingTransactionManagerTest.java | 27 +++++++++++-----------
21 files changed, 57 insertions(+), 50 deletions(-)
diff --git
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/CommandExecutorTaskAdviceTest.java
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/CommandExecutorTaskAdviceTest.java
index d9453e3..0b262fd 100644
---
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/CommandExecutorTaskAdviceTest.java
+++
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/CommandExecutorTaskAdviceTest.java
@@ -59,7 +59,7 @@ public final class CommandExecutorTaskAdviceTest extends
AbstractCommandExecutor
ADVICE.afterMethod(getTargetObject(), null, new Object[]{}, new
MethodInvocationResult());
List<MockSpan> spans = COLLECTOR.finishedSpans();
assertThat(spans.size(), is(1));
- assertThat(spans.get(0).logEntries().size(), is(0));
+ assertTrue(spans.get(0).logEntries().isEmpty());
assertThat(spans.get(0).operationName(),
is("/ShardingSphere/rootInvoke/"));
assertThat(spans.get(0).tags(), is(EXPECTED));
}
diff --git
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/JDBCExecutorCallbackAdviceTest.java
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/JDBCExecutorCallbackAdviceTest.java
index 67eb3f6..6448406 100644
---
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/JDBCExecutorCallbackAdviceTest.java
+++
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/JDBCExecutorCallbackAdviceTest.java
@@ -32,6 +32,7 @@ import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
public final class JDBCExecutorCallbackAdviceTest extends
AbstractJDBCExecutorCallbackAdviceTest {
@@ -53,7 +54,7 @@ public final class JDBCExecutorCallbackAdviceTest extends
AbstractJDBCExecutorCa
assertThat(spans.size(), is(1));
MockSpan span = spans.get(0);
Map<String, Object> tags = span.tags();
- assertThat(spans.get(0).logEntries().size(), is(0));
+ assertTrue(spans.get(0).logEntries().isEmpty());
assertThat(span.operationName(), is("/ShardingSphere/executeSQL/"));
assertThat(tags.get("db.instance"), is("mock.db"));
assertThat(tags.get("db.type"), is(JaegerConstants.DB_TYPE_VALUE));
diff --git
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/SQLParserEngineAdviceTest.java
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/SQLParserEngineAdviceTest.java
index ab61663..b815f18 100644
---
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/SQLParserEngineAdviceTest.java
+++
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/advice/SQLParserEngineAdviceTest.java
@@ -46,7 +46,7 @@ public final class SQLParserEngineAdviceTest extends
AbstractSQLParserEngineAdvi
ADVICE.afterMethod(getTargetObject(), null, new Object[]{}, new
MethodInvocationResult());
List<MockSpan> spans = COLLECTOR.finishedSpans();
assertThat(spans.size(), is(1));
- assertThat(spans.get(0).logEntries().size(), is(0));
+ assertTrue(spans.get(0).logEntries().isEmpty());
assertThat(spans.get(0).operationName(),
is("/ShardingSphere/parseSQL/"));
}
diff --git
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/CommandExecutorTaskAdviceTest.java
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/CommandExecutorTaskAdviceTest.java
index 1fe3294..4367724 100644
---
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/CommandExecutorTaskAdviceTest.java
+++
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/CommandExecutorTaskAdviceTest.java
@@ -73,7 +73,7 @@ public final class CommandExecutorTaskAdviceTest {
ADVICE.afterMethod(targetObject, executeCommandMethod, new Object[]{},
new MethodInvocationResult());
List<MockSpan> spans = tracer.finishedSpans();
assertThat(spans.size(), is(1));
- assertThat(spans.get(0).logEntries().size(), is(0));
+ assertTrue(spans.get(0).logEntries().isEmpty());
assertThat(spans.get(0).operationName(),
is("/ShardingSphere/rootInvoke/"));
}
diff --git
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/JDBCExecutorCallbackAdviceTest.java
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/JDBCExecutorCallbackAdviceTest.java
index 01c4def..004938c 100644
---
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/JDBCExecutorCallbackAdviceTest.java
+++
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/JDBCExecutorCallbackAdviceTest.java
@@ -41,6 +41,7 @@ import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -80,7 +81,7 @@ public final class JDBCExecutorCallbackAdviceTest {
assertThat(spans.size(), is(1));
MockSpan span = spans.get(0);
Map<String, Object> tags = span.tags();
- assertThat(spans.get(0).logEntries().size(), is(0));
+ assertTrue(spans.get(0).logEntries().isEmpty());
assertThat(span.operationName(), is("/ShardingSphere/executeSQL/"));
assertThat(tags.get("db.instance"), is("mock.db"));
assertThat(tags.get("db.type"), is("sql"));
diff --git
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/SQLParserEngineAdviceTest.java
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/SQLParserEngineAdviceTest.java
index 51e3341..961111d 100644
---
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/SQLParserEngineAdviceTest.java
+++
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/advice/SQLParserEngineAdviceTest.java
@@ -67,7 +67,7 @@ public final class SQLParserEngineAdviceTest {
ADVICE.afterMethod(targetObject, parserMethod, new Object[]{}, new
MethodInvocationResult());
List<MockSpan> spans = tracer.finishedSpans();
assertThat(spans.size(), is(1));
- assertThat(spans.get(0).logEntries().size(), is(0));
+ assertTrue(spans.get(0).logEntries().isEmpty());
assertThat(spans.get(0).operationName(),
is("/ShardingSphere/parseSQL/"));
}
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/PostgreSQLBinaryStatementRegistryTest.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/PostgreSQLBinaryStatementRegistryTest.java
index b35a53a..7651e91 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/PostgreSQLBinaryStatementRegistryTest.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/PostgreSQLBinaryStatementRegistryTest.java
@@ -28,6 +28,7 @@ import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
public final class PostgreSQLBinaryStatementRegistryTest {
@@ -40,7 +41,7 @@ public final class PostgreSQLBinaryStatementRegistryTest {
PostgreSQLBinaryStatementRegistry.getInstance().register(1,
statementId, sql, mock(SQLStatement.class), Collections.emptyList());
PostgreSQLBinaryStatement binaryStatement =
PostgreSQLBinaryStatementRegistry.getInstance().get(1, statementId);
assertThat(binaryStatement.getSql(), is(sql));
- assertThat(binaryStatement.getColumnTypes().size(), is(0));
+ assertTrue(binaryStatement.getColumnTypes().isEmpty());
}
@Test
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleAlgorithmProviderConfigurationYamlSwapperTest.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleAlgorithmProviderConfigurationYamlSwapperTest.java
index 8792210..83504e3 100644
---
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleAlgorithmProviderConfigurationYamlSwapperTest.java
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleAlgorithmProviderConfigurationYamlSwapperTest.java
@@ -38,6 +38,7 @@ import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
@RunWith(MockitoJUnitRunner.class)
public final class EncryptRuleAlgorithmProviderConfigurationYamlSwapperTest {
@@ -53,7 +54,7 @@ public final class
EncryptRuleAlgorithmProviderConfigurationYamlSwapperTest {
public void assertSwapToYamlConfiguration() {
YamlEncryptRuleConfiguration actual =
getSwapper().swapToYamlConfiguration(createAlgorithmProvidedEncryptRuleConfiguration());
assertThat(actual.getTables().size(), is(1));
- assertThat(actual.getEncryptors().size(), is(0));
+ assertTrue(actual.getEncryptors().isEmpty());
}
private AlgorithmProvidedEncryptRuleConfiguration
createAlgorithmProvidedEncryptRuleConfiguration() {
@@ -66,7 +67,7 @@ public final class
EncryptRuleAlgorithmProviderConfigurationYamlSwapperTest {
public void assertSwapToObject() {
AlgorithmProvidedEncryptRuleConfiguration actual =
getSwapper().swapToObject(createYamlEncryptRuleConfiguration());
assertThat(actual.getTables().size(), is(1));
- assertThat(actual.getEncryptors().size(), is(0));
+ assertTrue(actual.getEncryptors().isEmpty());
}
private YamlEncryptRuleConfiguration createYamlEncryptRuleConfiguration() {
diff --git
a/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/MySQLPrivilegeHandlerTest.java
b/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/MySQLPrivilegeHandlerTest.java
index 5c9855d..b3aa51d 100644
---
a/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/MySQLPrivilegeHandlerTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/MySQLPrivilegeHandlerTest.java
@@ -41,6 +41,7 @@ import java.util.stream.Collectors;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@@ -232,8 +233,8 @@ public final class MySQLPrivilegeHandlerTest {
assertThat(actual.get(root).getDatabasePrivileges().getGlobalPrivileges().size(),
is(6));
assertThat(actual.get(root).getDatabasePrivileges().getGlobalPrivileges(),
is(expectedDatabasePrivileges));
ShardingSphereUser sys = new ShardingSphereUser("mysql.sys", "",
"localhost");
-
assertThat(actual.get(sys).getAdministrativePrivileges().getPrivileges().size(),
is(0));
-
assertThat(actual.get(sys).getDatabasePrivileges().getGlobalPrivileges().size(),
is(0));
+
assertTrue(actual.get(sys).getAdministrativePrivileges().getPrivileges().isEmpty());
+
assertTrue(actual.get(sys).getDatabasePrivileges().getGlobalPrivileges().isEmpty());
assertThat(actual.get(sys).getDatabasePrivileges().getSpecificPrivileges().size(),
is(1));
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/OraclePrivilegeHandlerTest.java
b/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/OraclePrivilegeHandlerTest.java
index f8e58cb..544158a 100644
---
a/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/OraclePrivilegeHandlerTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/OraclePrivilegeHandlerTest.java
@@ -107,7 +107,7 @@ public final class OraclePrivilegeHandlerTest {
private void assertPrivileges(final Map<ShardingSphereUser,
NativePrivileges> actual) {
assertThat(actual.size(), is(1));
ShardingSphereUser user = new ShardingSphereUser("admin", "", "");
-
assertThat(actual.get(user).getDatabasePrivileges().getGlobalPrivileges().size(),
is(0));
+
assertTrue(actual.get(user).getDatabasePrivileges().getGlobalPrivileges().isEmpty());
assertThat(actual.get(user).getDatabasePrivileges().getSpecificPrivileges().size(),
is(1));
Collection<PrivilegeType> expectedSpecificPrivilege = new
CopyOnWriteArraySet<>(Arrays.asList(PrivilegeType.INSERT, PrivilegeType.SELECT,
PrivilegeType.UPDATE));
SchemaPrivileges schemaPrivileges =
actual.get(user).getDatabasePrivileges().getSpecificPrivileges().get("sys");
@@ -118,7 +118,7 @@ public final class OraclePrivilegeHandlerTest {
}
private Collection<ShardingSphereUser> createUsers() {
- LinkedList<ShardingSphereUser> result = new LinkedList<>();
+ Collection<ShardingSphereUser> result = new LinkedList<>();
result.add(new ShardingSphereUser("admin", "", ""));
return result;
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/SQLServerPrivilegeHandlerTest.java
b/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/SQLServerPrivilegeHandlerTest.java
index eef7b89..47fc52f 100644
---
a/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/SQLServerPrivilegeHandlerTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/provider/natived/builder/dialect/SQLServerPrivilegeHandlerTest.java
@@ -97,9 +97,9 @@ public final class SQLServerPrivilegeHandlerTest {
SchemaPrivileges schemaPrivileges =
actual.get(dbo).getDatabasePrivileges().getSpecificPrivileges().get("db0");
assertTrue(schemaPrivileges.getSpecificPrivileges().get("t_order").hasPrivileges(expectedSpecificPrivilege));
ShardingSphereUser testUser = new ShardingSphereUser("testUser", "",
"");
-
assertThat(actual.get(testUser).getAdministrativePrivileges().getPrivileges().size(),
is(0));
-
assertThat(actual.get(testUser).getDatabasePrivileges().getGlobalPrivileges().size(),
is(0));
-
assertThat(actual.get(testUser).getDatabasePrivileges().getSpecificPrivileges().size(),
is(0));
+
assertTrue(actual.get(testUser).getAdministrativePrivileges().getPrivileges().isEmpty());
+
assertTrue(actual.get(testUser).getDatabasePrivileges().getGlobalPrivileges().isEmpty());
+
assertTrue(actual.get(testUser).getDatabasePrivileges().getSpecificPrivileges().isEmpty());
}
private Collection<ShardingSphereUser> createUsers() {
diff --git
a/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/statement/impl/InsertStatementContextTest.java
b/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/statement/impl/InsertStatementContextTest.java
index 35ee900..550ea0a 100644
---
a/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/statement/impl/InsertStatementContextTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/statement/impl/InsertStatementContextTest.java
@@ -122,7 +122,7 @@ public final class InsertStatementContextTest {
InsertStatementContext actual =
createInsertStatementContext(Arrays.asList(1, "Tom", 2, "Jerry"),
insertStatement);
assertThat(actual.getGroupedParameters().size(), is(2));
assertNull(actual.getOnDuplicateKeyUpdateValueContext());
- assertThat(actual.getOnDuplicateKeyUpdateParameters().size(), is(0));
+ assertTrue(actual.getOnDuplicateKeyUpdateParameters().isEmpty());
}
@Test
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaBuilderTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaBuilderTest.java
index d16ca1d..5beb59e 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaBuilderTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaBuilderTest.java
@@ -91,9 +91,9 @@ public final class SchemaBuilderTest {
private void assertSchemaOfShardingTables(final Collection<TableMetaData>
actual) {
Map<String, TableMetaData> tableMetaDataMap =
actual.stream().collect(Collectors.toMap(TableMetaData::getName, v -> v));
assertTrue(tableMetaDataMap.containsKey("data_node_routed_table1"));
-
assertThat(tableMetaDataMap.get("data_node_routed_table1").getColumns().size(),
is(0));
+
assertTrue(tableMetaDataMap.get("data_node_routed_table1").getColumns().isEmpty());
assertTrue(tableMetaDataMap.containsKey("data_node_routed_table2"));
-
assertThat(tableMetaDataMap.get("data_node_routed_table2").getColumns().size(),
is(0));
+
assertTrue(tableMetaDataMap.get("data_node_routed_table2").getColumns().isEmpty());
}
@Test
@@ -119,8 +119,8 @@ public final class SchemaBuilderTest {
private void assertActualOfShardingTablesAndSingleTables(final
Collection<TableMetaData> actual) {
Map<String, TableMetaData> tableMetaDataMap =
actual.stream().collect(Collectors.toMap(TableMetaData::getName, v -> v));
assertTrue(tableMetaDataMap.containsKey(singleTableNames[0]));
-
assertThat(tableMetaDataMap.get(singleTableNames[0]).getColumns().size(),
is(0));
+
assertTrue(tableMetaDataMap.get(singleTableNames[0]).getColumns().isEmpty());
assertTrue(tableMetaDataMap.containsKey(singleTableNames[1]));
-
assertThat(tableMetaDataMap.get(singleTableNames[1]).getColumns().size(),
is(0));
+
assertTrue(tableMetaDataMap.get(singleTableNames[1]).getColumns().isEmpty());
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/SchemaYamlSwapperTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/SchemaYamlSwapperTest.java
index 3de6ced..949c1e0 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/SchemaYamlSwapperTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/SchemaYamlSwapperTest.java
@@ -33,6 +33,7 @@ import java.util.stream.Collectors;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
public final class SchemaYamlSwapperTest {
@@ -63,16 +64,13 @@ public final class SchemaYamlSwapperTest {
@Test
public void assertSwapToYamlSchemaWithoutTable() {
ShardingSphereSchema schema = new
SchemaYamlSwapper().swapToObject(YamlEngine.unmarshal(readYAML(YAML_WITHOUT_TABLE),
YamlSchema.class));
- YamlSchema yamlSchema = new
SchemaYamlSwapper().swapToYamlConfiguration(schema);
- assertNotNull(yamlSchema);
- assertThat(yamlSchema.getTables().size(), is(0));
+ assertTrue(new
SchemaYamlSwapper().swapToYamlConfiguration(schema).getTables().isEmpty());
}
@Test
public void assertSwapToShardingSphereSchemaWithoutTable() {
YamlSchema yamlSchema =
YamlEngine.unmarshal(readYAML(YAML_WITHOUT_TABLE), YamlSchema.class);
- ShardingSphereSchema schema = new
SchemaYamlSwapper().swapToObject(yamlSchema);
- assertThat(schema.getAllTableNames().size(), is(0));
+ assertTrue(new
SchemaYamlSwapper().swapToObject(yamlSchema).getAllTableNames().isEmpty());
}
@SneakyThrows({URISyntaxException.class, IOException.class})
diff --git
a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/kernel/ExecutorEngineTest.java
b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/kernel/ExecutorEngineTest.java
index 9870130..0630120 100644
---
a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/kernel/ExecutorEngineTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/kernel/ExecutorEngineTest.java
@@ -32,6 +32,7 @@ import java.util.concurrent.CountDownLatch;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
public final class ExecutorEngineTest {
@@ -100,6 +101,6 @@ public final class ExecutorEngineTest {
CountDownLatch latch = new CountDownLatch(1);
List<String> actual = executorEngine.execute(new
ExecutionGroupContext<>(new LinkedList<>()), new
ExecutorCallbackFixture(latch));
latch.countDown();
- assertThat(actual.size(), is(0));
+ assertTrue(actual.isEmpty());
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java
b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java
index c3caf99..0d32850 100644
---
a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java
@@ -45,6 +45,7 @@ import java.util.Optional;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -89,7 +90,7 @@ public final class JDBCExecutorCallbackTest {
Field field =
JDBCExecutorCallback.class.getDeclaredField("CACHED_DATASOURCE_METADATA");
field.setAccessible(true);
Map<String, DataSourceMetaData> cachedDataSourceMetaData =
(Map<String, DataSourceMetaData>) field.get(jdbcExecutorCallback);
- assertThat(cachedDataSourceMetaData.size(), is(0));
+ assertTrue(cachedDataSourceMetaData.isEmpty());
jdbcExecutorCallback.execute(units, true, Collections.emptyMap());
assertThat(cachedDataSourceMetaData.size(), is(1));
jdbcExecutorCallback.execute(units, true, Collections.emptyMap());
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/common/channel/distribution/ManualBitSetTest.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/common/channel/distribution/ManualBitSetTest.java
index 67b24b8..3ee3915 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/common/channel/distribution/ManualBitSetTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/common/channel/distribution/ManualBitSetTest.java
@@ -69,8 +69,8 @@ public final class ManualBitSetTest {
assertNotNull(bitSets);
assertThat(bitSets.size(), is(1));
bitSet.clear(1025);
- assertThat(bitSets.size(), is(0));
+ assertTrue(bitSets.isEmpty());
bitSet.clear(2049);
- assertThat(bitSets.size(), is(0));
+ assertTrue(bitSets.isEmpty());
}
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceManagerTest.java
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceManagerTest.java
index c2d7964..6c6d8cf 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceManagerTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/common/datasource/DataSourceManagerTest.java
@@ -32,6 +32,7 @@ import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
public final class DataSourceManagerTest {
@@ -56,6 +57,6 @@ public final class DataSourceManagerTest {
assertNotNull(cachedDataSources);
assertThat(cachedDataSources.size(), is(2));
dataSourceManager.close();
- assertThat(cachedDataSources.size(), is(0));
+ assertTrue(cachedDataSources.isEmpty());
}
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLBinlogEventPacketDecoderTest.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLBinlogEventPacketDecoderTest.java
index ac0584d..0de1a01 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLBinlogEventPacketDecoderTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLBinlogEventPacketDecoderTest.java
@@ -38,6 +38,7 @@ import java.util.List;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
@@ -76,7 +77,7 @@ public final class MySQLBinlogEventPacketDecoderTest {
when(byteBuf.readUnsignedByte()).thenReturn((short) 0, (short) 0,
(short) MySQLBinlogEventType.ROTATE_EVENT.getValue());
List<Object> decodedEvents = new LinkedList<>();
binlogEventPacketDecoder.decode(null, byteBuf, decodedEvents);
- assertThat(decodedEvents.size(), is(0));
+ assertTrue(decodedEvents.isEmpty());
assertThat(binlogContext.getFileName(), is(""));
}
@@ -86,7 +87,7 @@ public final class MySQLBinlogEventPacketDecoderTest {
when(byteBuf.readUnsignedShortLE()).thenReturn(4);
List<Object> decodedEvents = new LinkedList<>();
binlogEventPacketDecoder.decode(null, byteBuf, decodedEvents);
- assertThat(decodedEvents.size(), is(0));
+ assertTrue(decodedEvents.isEmpty());
assertThat(binlogContext.getChecksumLength(), is(4));
}
@@ -95,7 +96,7 @@ public final class MySQLBinlogEventPacketDecoderTest {
when(byteBuf.readUnsignedByte()).thenReturn((short) 0, (short) 0,
(short) MySQLBinlogEventType.TABLE_MAP_EVENT.getValue(), (short) 0);
List<Object> decodedEvents = new LinkedList<>();
binlogEventPacketDecoder.decode(null, byteBuf, decodedEvents);
- assertThat(decodedEvents.size(), is(0));
+ assertTrue(decodedEvents.isEmpty());
assertThat(binlogContext.getTableMap().size(), is(1));
assertThat(binlogContext.getTableMap().get(0L),
instanceOf(MySQLBinlogTableMapEventPacket.class));
}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/distsql/PropertiesAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/distsql/PropertiesAssert.java
index a18d915..fd5c98d 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/distsql/PropertiesAssert.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/distsql/PropertiesAssert.java
@@ -25,9 +25,8 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import java.util.Properties;
-import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
/**
* Properties assert.
@@ -49,7 +48,7 @@ public final class PropertiesAssert {
PropertyAssert.assertIs(assertContext, actual,
expectedProperty);
}
} else {
- assertThat(assertContext.getText("Actual should not exist."),
actual.size(), is(0));
+ assertTrue(assertContext.getText("Actual should not exist."),
actual.isEmpty());
}
}
}
diff --git
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/XAShardingTransactionManagerTest.java
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/XAShardingTransactionManagerTest.java
index 1eff1a9..1986d36 100644
---
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/XAShardingTransactionManagerTest.java
+++
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/XAShardingTransactionManagerTest.java
@@ -19,21 +19,12 @@ package org.apache.shardingsphere.transaction.xa;
import com.atomikos.jdbc.AtomikosDataSourceBean;
import com.zaxxer.hikari.HikariDataSource;
-import java.lang.reflect.Field;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.transaction.Transaction;
import lombok.SneakyThrows;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
import org.apache.shardingsphere.transaction.core.ResourceDataSource;
-import org.apache.shardingsphere.transaction.core.XATransactionManagerType;
import org.apache.shardingsphere.transaction.core.TransactionType;
+import org.apache.shardingsphere.transaction.core.XATransactionManagerType;
import org.apache.shardingsphere.transaction.xa.fixture.DataSourceUtils;
import
org.apache.shardingsphere.transaction.xa.jta.datasource.XATransactionDataSource;
import org.junit.After;
@@ -42,6 +33,16 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
+import javax.transaction.Transaction;
+import java.lang.reflect.Field;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
@@ -99,13 +100,13 @@ public final class XAShardingTransactionManagerTest {
public void assertGetConnectionOfNestedTransaction() throws SQLException {
ThreadLocal<Set<Transaction>> transactions =
getEnlistedTransactions(getCachedDataSources().get("ds1"));
xaShardingTransactionManager.begin();
- assertThat(transactions.get().size(), is(0));
+ assertTrue(transactions.get().isEmpty());
xaShardingTransactionManager.getConnection("ds1");
assertThat(transactions.get().size(), is(1));
executeNestedTransaction(transactions);
assertThat(transactions.get().size(), is(1));
xaShardingTransactionManager.commit();
- assertThat(transactions.get().size(), is(0));
+ assertTrue(transactions.get().isEmpty());
}
private void executeNestedTransaction(final ThreadLocal<Set<Transaction>>
transactions) throws SQLException {
@@ -120,7 +121,7 @@ public final class XAShardingTransactionManagerTest {
public void assertClose() throws Exception {
xaShardingTransactionManager.close();
Map<String, XATransactionDataSource> cachedSingleXADataSourceMap =
getCachedDataSources();
- assertThat(cachedSingleXADataSourceMap.size(), is(0));
+ assertTrue(cachedSingleXADataSourceMap.isEmpty());
}
@Test