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 b2797d9  Use assertNull to instead of assertThat(xxx, nullValue()) 
(#11529)
b2797d9 is described below

commit b2797d95e1f65e3350b2295066421af2ea824bce
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Jul 27 13:36:04 2021 +0800

    Use assertNull to instead of assertThat(xxx, nullValue()) (#11529)
---
 .../protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java   |  5 ++---
 .../merge/dql/groupby/GroupByMemoryMergedResultTest.java     | 12 ++++++------
 .../authority/checker/AuthorityCheckerTest.java              |  6 ++----
 .../scaling/core/executor/importer/DataRecordMergerTest.java | 10 +++++-----
 4 files changed, 15 insertions(+), 18 deletions(-)

diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
index ab67bb4..cb59536 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
@@ -21,8 +21,7 @@ import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLBinaryColumnTyp
 import org.junit.Test;
 
 import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 
 public final class MySQLMySQLBinaryProtocolValueFactoryTest {
@@ -154,7 +153,7 @@ public final class MySQLMySQLBinaryProtocolValueFactoryTest 
{
     
     @Test
     public void assertGetBinaryProtocolValueWithMySQLTypeNull() {
-        
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_NULL),
 is(nullValue()));
+        
assertNull(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_NULL));
     }
     
     @Test(expected = IllegalArgumentException.class)
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java
index ebcb8fd..fe31c4d 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java
@@ -17,10 +17,6 @@
 
 package org.apache.shardingsphere.sharding.merge.dql.groupby;
 
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
-import org.apache.shardingsphere.infra.merge.result.MergedResult;
-import org.apache.shardingsphere.sharding.merge.dql.ShardingDQLResultMerger;
 import 
org.apache.shardingsphere.infra.binder.segment.select.groupby.GroupByContext;
 import 
org.apache.shardingsphere.infra.binder.segment.select.orderby.OrderByContext;
 import 
org.apache.shardingsphere.infra.binder.segment.select.orderby.OrderByItem;
@@ -28,6 +24,10 @@ import 
org.apache.shardingsphere.infra.binder.segment.select.pagination.Paginati
 import 
org.apache.shardingsphere.infra.binder.segment.select.projection.ProjectionsContext;
 import 
org.apache.shardingsphere.infra.binder.segment.select.projection.impl.AggregationProjection;
 import 
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
+import org.apache.shardingsphere.infra.merge.result.MergedResult;
+import org.apache.shardingsphere.sharding.merge.dql.ShardingDQLResultMerger;
 import 
org.apache.shardingsphere.sql.parser.sql.common.constant.AggregationType;
 import org.apache.shardingsphere.sql.parser.sql.common.constant.OrderDirection;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.ProjectionsSegment;
@@ -42,8 +42,8 @@ import java.util.Arrays;
 import java.util.Collections;
 
 import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
@@ -58,7 +58,7 @@ public final class GroupByMemoryMergedResultTest {
         MergedResult actual = 
resultMerger.merge(Arrays.asList(createQueryResult(), createQueryResult(), 
createQueryResult()), createSelectStatementContext(), null);
         assertTrue(actual.next());
         assertThat(actual.getValue(1, Object.class), is(0));
-        assertThat(actual.getValue(2, Object.class), is(nullValue()));
+        assertNull(actual.getValue(2, Object.class));
         assertFalse(actual.next());
     }
     
diff --git 
a/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java
 
b/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java
index f9080b2..b77a36b 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java
@@ -45,10 +45,8 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.stream.Collectors;
 
-import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-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;
@@ -73,7 +71,7 @@ public final class AuthorityCheckerTest {
         AuthorityRuleConfiguration ruleConfig = new 
AuthorityRuleConfiguration(Collections.emptyList(), new 
ShardingSphereAlgorithmConfiguration("ALL_PRIVILEGES_PERMITTED", new 
Properties()));
         AuthorityRule rule = new AuthorityRule(ruleConfig, 
Collections.emptyMap(), users);
         SQLChecker<AuthorityRule> sqlChecker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(rule), 
SQLChecker.class).get(rule);
-        assertThat(sqlChecker, notNullValue());
+        assertNotNull(sqlChecker);
         assertTrue(sqlChecker.check("db0", new Grantee("root", "localhost"), 
rule));
     }
     
@@ -86,7 +84,7 @@ public final class AuthorityCheckerTest {
         AuthorityRuleConfiguration ruleConfig = new 
AuthorityRuleConfiguration(Collections.emptyList(), new 
ShardingSphereAlgorithmConfiguration("NATIVE", new Properties()));
         AuthorityRule rule = new AuthorityRule(ruleConfig, 
createMetaDataMap(users), users);
         SQLChecker<AuthorityRule> sqlChecker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(rule), 
SQLChecker.class).get(rule);
-        assertThat(sqlChecker, notNullValue());
+        assertNotNull(sqlChecker);
         assertTrue(sqlChecker.check("db0", new Grantee("root", "localhost"), 
rule));
         assertFalse(sqlChecker.check("db1", new Grantee("root", "localhost"), 
rule));
         assertFalse(sqlChecker.check("db0", new Grantee("other", "localhost"), 
rule));
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/executor/importer/DataRecordMergerTest.java
 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/executor/importer/DataRecordMergerTest.java
index 3ff18bd..c6236ae 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/executor/importer/DataRecordMergerTest.java
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/executor/importer/DataRecordMergerTest.java
@@ -30,8 +30,8 @@ import java.util.Collection;
 import java.util.List;
 
 import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
 import static org.hamcrest.CoreMatchers.sameInstance;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 
 public final class DataRecordMergerTest {
@@ -76,7 +76,7 @@ public final class DataRecordMergerTest {
         DataRecord dataRecord = actual.iterator().next();
         assertThat(dataRecord.getType(), is(ScalingConstant.INSERT));
         assertThat(dataRecord.getTableName(), is("order"));
-        assertThat(dataRecord.getColumn(0).getOldValue(), nullValue());
+        assertNull(dataRecord.getColumn(0).getOldValue());
         assertThat(dataRecord.getColumn(0).getValue(), is(1));
         assertThat(dataRecord.getColumn(1).getValue(), is(2));
         assertThat(dataRecord.getColumn(2).getValue(), is(2));
@@ -91,7 +91,7 @@ public final class DataRecordMergerTest {
         DataRecord dataRecord = actual.iterator().next();
         assertThat(dataRecord.getType(), is(ScalingConstant.INSERT));
         assertThat(dataRecord.getTableName(), is("order"));
-        assertThat(dataRecord.getColumn(0).getOldValue(), nullValue());
+        assertNull(dataRecord.getColumn(0).getOldValue());
         assertThat(dataRecord.getColumn(0).getValue(), is(2));
         assertThat(dataRecord.getColumn(1).getValue(), is(2));
         assertThat(dataRecord.getColumn(2).getValue(), is(2));
@@ -106,7 +106,7 @@ public final class DataRecordMergerTest {
         DataRecord dataRecord = actual.iterator().next();
         assertThat(dataRecord.getType(), is(ScalingConstant.UPDATE));
         assertThat(dataRecord.getTableName(), is("order"));
-        assertThat(dataRecord.getColumn(0).getOldValue(), nullValue());
+        assertNull(dataRecord.getColumn(0).getOldValue());
         assertThat(dataRecord.getColumn(0).getValue(), is(1));
         assertThat(dataRecord.getColumn(1).getValue(), is(2));
         assertThat(dataRecord.getColumn(2).getValue(), is(2));
@@ -191,7 +191,7 @@ public final class DataRecordMergerTest {
         DataRecord dataRecord = actual.iterator().next();
         assertThat(dataRecord.getType(), is(ScalingConstant.DELETE));
         assertThat(dataRecord.getTableName(), is("order"));
-        assertThat(dataRecord.getColumn(0).getOldValue(), nullValue());
+        assertNull(dataRecord.getColumn(0).getOldValue());
         assertThat(dataRecord.getColumn(0).getValue(), is(1));
         assertThat(dataRecord.getColumn(1).getValue(), is(1));
         assertThat(dataRecord.getColumn(2).getValue(), is(1));

Reply via email to