Apache Solr open-source search software
SOLR-17217: Simplify verbose MatcherAssert.assertThat usage in tests
Chris Hostetter2fe98d962bb4
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 8585748e5a1..44f53f5a42b 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -181,6 +181,8 @@ Other Changes* SOLR-17201: Http2SolrClient and friends no longer marked as @lucene.experimental.Krb5HttpClientBuilder and PreemptiveBasicAuthClientBuilderFactory no longer deprecated (janhoy)+* SOLR-17217: Simplify verbose MatcherAssert.assertThat usage in tests (hossman)+================== 9.5.0 ==================New Features---------------------diff --git a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.javaindex 7413aa88cd2..ae55c613c26 100644--- a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java+++ b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java@@ -30,7 +30,6 @@ import org.apache.solr.common.params.CommonParams;import org.apache.solr.common.params.ModifiableSolrParams;import org.apache.solr.common.params.SolrParams;import org.apache.solr.common.util.NamedList;-import org.hamcrest.MatcherAssert;import org.junit.Test;/**@@ -888,7 +887,7 @@ public class TestDistributedGrouping extends BaseDistributedSearchTestCase {"group.offset","-1"));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, exception.code());- MatcherAssert.assertThat(+ assertThat(exception.getMessage(), containsString("'group.offset' parameter cannot be negative"));resetExceptionIgnores();diff --git a/solr/core/src/test/org/apache/solr/cloud/CreateCollectionCleanupTest.java b/solr/core/src/test/org/apache/solr/cloud/CreateCollectionCleanupTest.javaindex e372e355724..fcc77078a11 100644--- a/solr/core/src/test/org/apache/solr/cloud/CreateCollectionCleanupTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/CreateCollectionCleanupTest.java@@ -29,7 +29,6 @@ import org.apache.solr.client.solrj.impl.CloudSolrClient;import org.apache.solr.client.solrj.request.CollectionAdminRequest;import org.apache.solr.client.solrj.response.RequestStatusState;import org.apache.solr.common.params.CoreAdminParams;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;@@ -76,8 +75,7 @@ public class CreateCollectionCleanupTest extends SolrCloudTestCase {public void testCreateCollectionCleanup() throws Exception {final CloudSolrClient cloudClient = cluster.getSolrClient();String collectionName = "foo";- MatcherAssert.assertThat(- CollectionAdminRequest.listCollections(cloudClient), not(hasItem(collectionName)));+ assertThat(CollectionAdminRequest.listCollections(cloudClient), not(hasItem(collectionName)));// Create a collection that would failCollectionAdminRequest.Create create =CollectionAdminRequest.createCollection(collectionName, "conf1", 1, 1);@@ -95,7 +93,7 @@ public class CreateCollectionCleanupTest extends SolrCloudTestCase {});// Confirm using LIST that the collection does not exist- MatcherAssert.assertThat(+ assertThat("Failed collection is still in the clusterstate: "+ cluster.getSolrClient().getClusterState().getCollectionOrNull(collectionName),CollectionAdminRequest.listCollections(cloudClient),@@ -106,8 +104,7 @@ public class CreateCollectionCleanupTest extends SolrCloudTestCase {public void testAsyncCreateCollectionCleanup() throws Exception {final CloudSolrClient cloudClient = cluster.getSolrClient();String collectionName = "foo2";- MatcherAssert.assertThat(- CollectionAdminRequest.listCollections(cloudClient), not(hasItem(collectionName)));+ assertThat(CollectionAdminRequest.listCollections(cloudClient), not(hasItem(collectionName)));// Create a collection that would failCollectionAdminRequest.Create create =@@ -125,10 +122,10 @@ public class CreateCollectionCleanupTest extends SolrCloudTestCase {RequestStatusState state =AbstractFullDistribZkTestBase.getRequestStateAfterCompletion("testAsyncCreateCollectionCleanup", 30, cloudClient);- MatcherAssert.assertThat(state.getKey(), is("failed"));+ assertThat(state.getKey(), is("failed"));// Confirm using LIST that the collection does not exist- MatcherAssert.assertThat(+ assertThat("Failed collection is still in the clusterstate: "+ cluster.getSolrClient().getClusterState().getCollectionOrNull(collectionName),CollectionAdminRequest.listCollections(cloudClient),diff --git a/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java b/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.javaindex 305b28c34d6..0a772a5609b 100644--- a/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java@@ -40,7 +40,6 @@ import org.apache.solr.common.cloud.ClusterState;import org.apache.solr.common.cloud.Replica;import org.apache.solr.common.cloud.Slice;import org.apache.solr.common.cloud.ZkStateReader;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -204,7 +203,7 @@ public class DistribJoinFromCollectionTest extends SolrCloudTestCase {private void assertScore(boolean isScoresTest, SolrDocument doc) {if (isScoresTest) {- MatcherAssert.assertThat(+ assertThat("score join doesn't return 1.0", doc.getFirstValue("score").toString(), not("1.0"));} else {assertEquals("Solr join has constant score", "1.0", doc.getFirstValue("score").toString());diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionContextKeyTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionContextKeyTest.javaindex 0fd64f1306c..06deacc0bd9 100644--- a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionContextKeyTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionContextKeyTest.java@@ -32,7 +32,6 @@ import org.apache.solr.common.cloud.SolrZkClient;import org.apache.solr.common.cloud.ZkStateReader;import org.apache.zookeeper.KeeperException;import org.hamcrest.CoreMatchers;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;@@ -115,11 +114,11 @@ public class LeaderElectionContextKeyTest extends SolrCloudTestCase {}assertTrue(found);// There are no leader election was kicked off on testCollection2- MatcherAssert.assertThat(+ assertThat(collection2Shard1Nodes,CoreMatchers.is(getElectionNodes(TEST_COLLECTION_2, "shard1", stateReader.getZkClient())));- MatcherAssert.assertThat(+ assertThat(collection2Shard2Nodes,CoreMatchers.is(getElectionNodes(TEST_COLLECTION_2, "shard2", stateReader.getZkClient())));diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderTragicEventTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderTragicEventTest.javaindex a1453f07cc2..a40adaa5046 100644--- a/solr/core/src/test/org/apache/solr/cloud/LeaderTragicEventTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/LeaderTragicEventTest.java@@ -39,7 +39,6 @@ import org.apache.solr.common.cloud.Replica;import org.apache.solr.common.cloud.Slice;import org.apache.solr.embedded.JettySolrRunner;import org.apache.solr.util.TestInjection;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.Before;import org.junit.BeforeClass;@@ -138,7 +137,7 @@ public class LeaderTragicEventTest extends SolrCloudTestCase {} catch (RemoteSolrException e) {// solrClient.add would throw RemoteSolrException with code 500// or 404 if the bad replica has already been deleted- MatcherAssert.assertThat(e.code(), anyOf(is(500), is(404)));+ assertThat(e.code(), anyOf(is(500), is(404)));} catch (AlreadyClosedException e) {// If giving up leadership, might be already closed/closing}diff --git a/solr/core/src/test/org/apache/solr/cloud/RemoteQueryErrorTest.java b/solr/core/src/test/org/apache/solr/cloud/RemoteQueryErrorTest.javaindex b764f6d6629..9da524dfc9b 100644--- a/solr/core/src/test/org/apache/solr/cloud/RemoteQueryErrorTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/RemoteQueryErrorTest.java@@ -23,7 +23,6 @@ import org.apache.solr.client.solrj.request.CollectionAdminRequest;import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.embedded.JettySolrRunner;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;@@ -51,7 +50,7 @@ public class RemoteQueryErrorTest extends SolrCloudTestCase {() -> {client.add("collection", new SolrInputDocument());});- MatcherAssert.assertThat(+ assertThat(e.getMessage(), containsString("Document is missing mandatory uniqueKey field: id"));}}diff --git a/solr/core/src/test/org/apache/solr/cloud/SplitShardTest.java b/solr/core/src/test/org/apache/solr/cloud/SplitShardTest.javaindex efd858ea4cb..a213af89c6e 100644--- a/solr/core/src/test/org/apache/solr/cloud/SplitShardTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/SplitShardTest.java@@ -46,7 +46,6 @@ import org.apache.solr.common.cloud.Replica;import org.apache.solr.common.cloud.Slice;import org.apache.solr.common.util.NamedList;import org.apache.solr.embedded.JettySolrRunner;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.Before;import org.junit.BeforeClass;@@ -138,7 +137,7 @@ public class SplitShardTest extends SolrCloudTestCase {.setShardName("shard1");SolrException thrown =assertThrows(SolrException.class, () -> splitShard.process(cluster.getSolrClient()));- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),containsString("numSubShards can not be specified with split.key or ranges parameters"));}diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudPseudoReturnFields.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudPseudoReturnFields.javaindex 2831202dcfb..c40a986c024 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestCloudPseudoReturnFields.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudPseudoReturnFields.java@@ -47,7 +47,6 @@ import org.apache.solr.common.params.ModifiableSolrParams;import org.apache.solr.common.params.SolrParams;import org.apache.solr.embedded.JettySolrRunner;import org.apache.solr.search.TestPseudoReturnFields;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.Before;import org.junit.BeforeClass;@@ -745,16 +744,15 @@ public class TestCloudPseudoReturnFields extends SolrCloudTestCase {assertTrue(msg, doc.getFieldValue("[docid]") instanceof Integer);assertTrue(msg, doc.getFieldValue("shard_id") instanceof String);- MatcherAssert.assertThat(doc.getFieldValue("shard_id").toString(), startsWith("shard"));+ assertThat(doc.getFieldValue("shard_id").toString(), startsWith("shard"));assertTrue(msg, doc.getFieldValue("replica_urls") instanceof String);- MatcherAssert.assertThat(+ assertThat(doc.getFieldValue("replica_urls").toString(),containsString("/solr/org.apache.solr.cloud.TestCloudPseudoReturnFields_collection_shard"));if (1 < repFactor) {- MatcherAssert.assertThat(- doc.getFieldValue("replica_urls").toString(), containsString("|"));+ assertThat(doc.getFieldValue("replica_urls").toString(), containsString("|"));}assertEquals(msg, doc.getFieldValue("shard_id"), doc.getFieldValue("[shard]"));@@ -791,16 +789,15 @@ public class TestCloudPseudoReturnFields extends SolrCloudTestCase {String msg = p + " => " + doc;assertTrue(msg, doc.getFieldValue("shard_id") instanceof String);- MatcherAssert.assertThat(doc.getFieldValue("shard_id").toString(), startsWith("shard"));+ assertThat(doc.getFieldValue("shard_id").toString(), startsWith("shard"));assertTrue(msg, doc.getFieldValue("replica_urls") instanceof String);- MatcherAssert.assertThat(+ assertThat(doc.getFieldValue("replica_urls").toString(),containsString("/solr/org.apache.solr.cloud.TestCloudPseudoReturnFields_collection_shard"));if (1 < repFactor) {- MatcherAssert.assertThat(- doc.getFieldValue("replica_urls").toString(), containsString("|"));+ assertThat(doc.getFieldValue("replica_urls").toString(), containsString("|"));}assertEquals(msg, doc.getFieldValue("shard_id"), doc.getFieldValue("[shard]"));diff --git a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.javaindex f7c9431c296..57a067cc217 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java@@ -106,7 +106,6 @@ import org.apache.solr.util.ExternalPaths;import org.apache.zookeeper.CreateMode;import org.apache.zookeeper.KeeperException;import org.apache.zookeeper.data.Stat;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.AfterClass;import org.junit.Assume;@@ -1402,8 +1401,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {});unIgnoreException("uploaded without any authentication in place");- MatcherAssert.assertThat(- thrown.getMessage(), containsString("Underlying core creation failed"));+ assertThat(thrown.getMessage(), containsString("Underlying core creation failed"));// Authorization onfinal String trustedSuffix = "-trusted";@@ -1438,8 +1436,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {});unIgnoreException("without any authentication in place");- MatcherAssert.assertThat(- thrown.getMessage(), containsString("Underlying core creation failed"));+ assertThat(thrown.getMessage(), containsString("Underlying core creation failed"));// Authorization onfinal String trustedSuffix = "-trusted";diff --git a/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java b/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.javaindex 713e11c807c..8285d15d206 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java@@ -25,7 +25,6 @@ import org.apache.solr.client.solrj.request.UpdateRequest;import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.common.params.ShardParams;import org.apache.solr.embedded.JettySolrRunner;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;@@ -54,8 +53,8 @@ public class TestDownShardTolerantSearch extends SolrCloudTestCase {QueryResponse response =cluster.getSolrClient().query("tolerant", new SolrQuery("*:*").setRows(1));- MatcherAssert.assertThat(response.getStatus(), is(0));- MatcherAssert.assertThat(response.getResults().getNumFound(), is(100L));+ assertThat(response.getStatus(), is(0));+ assertThat(response.getResults().getNumFound(), is(100L));JettySolrRunner stoppedServer = cluster.stopJettySolrRunner(0);@@ -67,7 +66,7 @@ public class TestDownShardTolerantSearch extends SolrCloudTestCase {.query("tolerant",new SolrQuery("*:*").setRows(1).setParam(ShardParams.SHARDS_TOLERANT, true));- MatcherAssert.assertThat(response.getStatus(), is(0));+ assertThat(response.getStatus(), is(0));assertTrue(response.getResults().getNumFound() > 0);SolrServerException e =diff --git a/solr/core/src/test/org/apache/solr/cloud/TestDynamicFieldNamesIndexCorrectly.java b/solr/core/src/test/org/apache/solr/cloud/TestDynamicFieldNamesIndexCorrectly.javaindex cd3061362dc..c94bfcd9605 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestDynamicFieldNamesIndexCorrectly.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestDynamicFieldNamesIndexCorrectly.java@@ -36,7 +36,6 @@ import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.common.SolrDocument;import org.apache.solr.common.SolrDocumentList;import org.apache.solr.common.SolrInputDocument;-import org.hamcrest.MatcherAssert;import org.hamcrest.core.IsEqual;import org.hamcrest.core.IsIterableContaining;import org.junit.Test;@@ -97,7 +96,7 @@ public class TestDynamicFieldNamesIndexCorrectly extends AbstractFullDistribZkTe.getFieldNames().forEach(fieldName -> {- MatcherAssert.assertThat(+ assertThat(String.format(Locale.ROOT,"Doc %s does not have field %s, it has %s",diff --git a/solr/core/src/test/org/apache/solr/cloud/TestRSAKeyPair.java b/solr/core/src/test/org/apache/solr/cloud/TestRSAKeyPair.javaindex 1e614cb7a34..e24beda4d2c 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestRSAKeyPair.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestRSAKeyPair.java@@ -26,7 +26,6 @@ import java.util.Arrays;import org.apache.lucene.tests.util.TestUtil;import org.apache.solr.SolrTestCase;import org.apache.solr.util.CryptoKeys;-import org.hamcrest.MatcherAssert;import org.junit.Test;public class TestRSAKeyPair extends SolrTestCase {@@ -51,7 +50,7 @@ public class TestRSAKeyPair extends SolrTestCase {final byte[] plaintext = plaintextString.getBytes(StandardCharsets.UTF_8);byte[] encrypted = kp.encrypt(ByteBuffer.wrap(plaintext));- MatcherAssert.assertThat(plaintext, not(equalTo(encrypted)));+ assertThat(plaintext, not(equalTo(encrypted)));byte[] decrypted = CryptoKeys.decryptRSA(encrypted, kp.getPublicKey());diff --git a/solr/core/src/test/org/apache/solr/cloud/TestShardsInfoResponse.java b/solr/core/src/test/org/apache/solr/cloud/TestShardsInfoResponse.javaindex b318d23d21a..f7e0ce2242c 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestShardsInfoResponse.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestShardsInfoResponse.java@@ -26,7 +26,6 @@ import org.apache.solr.client.solrj.request.UpdateRequest;import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.common.params.ShardParams;import org.apache.solr.common.util.SimpleOrderedMap;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;@@ -83,7 +82,6 @@ public class TestShardsInfoResponse extends SolrCloudTestCase {// The names of the shards in error are generated as unknown_shard_1 and unknown_shard_2 because// we could not get the real shard names.- MatcherAssert.assertThat(- (Iterable<String>) keys, hasItems("unknown_shard_1", "unknown_shard_2"));+ assertThat((Iterable<String>) keys, hasItems("unknown_shard_1", "unknown_shard_2"));}}diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.javaindex 232475ab6ef..6d207721dbf 100644--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIAsyncDistributedZkTest.java@@ -43,7 +43,6 @@ import org.apache.solr.common.cloud.Slice;import org.apache.solr.common.util.ExecutorUtil;import org.apache.solr.common.util.SolrNamedThreadFactory;import org.apache.solr.embedded.JettySolrRunner;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.Before;import org.junit.Test;@@ -282,7 +281,7 @@ public class CollectionsAPIAsyncDistributedZkTest extends SolrCloudTestCase {if (log.isInfoEnabled()) {log.info("Exception during collection reloading, we were waiting for one: ", e);}- MatcherAssert.assertThat(+ assertThat(e.getMessage(),containsString("Task with the same requestid already exists. (repeatedId)"));numFailure.incrementAndGet();diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/PurgeGraphTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/PurgeGraphTest.javaindex b2374f89a57..74b4a3d8f67 100644--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/PurgeGraphTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/PurgeGraphTest.java@@ -36,7 +36,6 @@ import org.apache.solr.core.backup.ShardBackupId;import org.apache.solr.core.backup.ShardBackupMetadata;import org.apache.solr.core.backup.repository.BackupRepository;import org.apache.solr.core.backup.repository.LocalFileSystemRepository;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.Test;@@ -123,13 +122,13 @@ public class PurgeGraphTest extends SolrTestCaseJ4 {// All files associated with backup '0' should be flagged for deletion since the required file// 'uniqName3' is missing.assertEquals(1, purgeGraph.backupIdDeletes.size());- MatcherAssert.assertThat(purgeGraph.backupIdDeletes, containsInAnyOrder("backup_0.properties"));+ assertThat(purgeGraph.backupIdDeletes, containsInAnyOrder("backup_0.properties"));assertEquals(2, purgeGraph.shardBackupMetadataDeletes.size());- MatcherAssert.assertThat(+ assertThat(purgeGraph.shardBackupMetadataDeletes,containsInAnyOrder("md_shard1_0.json", "md_shard2_0.json"));assertEquals(3, purgeGraph.indexFileDeletes.size());- MatcherAssert.assertThat(+ assertThat(purgeGraph.indexFileDeletes, containsInAnyOrder("uniqName1", "uniqName2", "uniqName4"));// If a subsequent backup relies on an index file (uniqName4) that was previously only used by@@ -141,14 +140,14 @@ public class PurgeGraphTest extends SolrTestCaseJ4 {// createUniquelyNamedIndexFile("uniqName5", "uniqName6");//// assertEquals(1, purgeGraph.backupIdDeletes.size());- // MatcherAssert.assertThat(purgeGraph.backupIdDeletes,+ // assertThat(purgeGraph.backupIdDeletes,// containsInAnyOrder("backup_0.properties"));// assertEquals(2, purgeGraph.shardBackupMetadataDeletes.size());- // MatcherAssert.assertThat(purgeGraph.shardBackupMetadataDeletes,+ // assertThat(purgeGraph.shardBackupMetadataDeletes,// containsInAnyOrder("md_shard1_0.json", "md_shard2_0.json"));// // NOTE that 'uniqName4' is NOT marked for deletion// assertEquals(2, purgeGraph.indexFileDeletes.size());- // MatcherAssert.assertThat(purgeGraph.indexFileDeletes, containsInAnyOrder("uniqName1",+ // assertThat(purgeGraph.indexFileDeletes, containsInAnyOrder("uniqName1",// "uniqName2"));}@@ -171,11 +170,9 @@ public class PurgeGraphTest extends SolrTestCaseJ4 {assertEquals(0, purgeGraph.backupIdDeletes.size());assertEquals(1, purgeGraph.shardBackupMetadataDeletes.size());- MatcherAssert.assertThat(- purgeGraph.shardBackupMetadataDeletes, containsInAnyOrder("md_shard3_0.json"));+ assertThat(purgeGraph.shardBackupMetadataDeletes, containsInAnyOrder("md_shard3_0.json"));assertEquals(2, purgeGraph.indexFileDeletes.size());- MatcherAssert.assertThat(- purgeGraph.indexFileDeletes, containsInAnyOrder("uniqName5", "uniqName6"));+ assertThat(purgeGraph.indexFileDeletes, containsInAnyOrder("uniqName5", "uniqName6"));// If a subsequent backup relies on an index file (uniqName5) that was previously only used by// the orphaned 'shard3' metadata file, that file should no longer be flagged for deletion@@ -189,10 +186,10 @@ public class PurgeGraphTest extends SolrTestCaseJ4 {//// assertEquals(0, purgeGraph.backupIdDeletes.size());// assertEquals(1, purgeGraph.shardBackupMetadataDeletes.size());- // MatcherAssert.assertThat(purgeGraph.shardBackupMetadataDeletes,+ // assertThat(purgeGraph.shardBackupMetadataDeletes,// containsInAnyOrder("md_shard3_0.json"));// assertEquals(1, purgeGraph.indexFileDeletes.size());- // MatcherAssert.assertThat(purgeGraph.indexFileDeletes,+ // assertThat(purgeGraph.indexFileDeletes,// containsInAnyOrder("uniqName6"));}diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.javaindex 6d3f208761a..3a9f736c440 100644--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.java+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.java@@ -34,7 +34,6 @@ import org.apache.solr.common.params.CollectionParams;import org.apache.solr.common.params.CommonAdminParams;import org.apache.solr.common.params.ModifiableSolrParams;import org.apache.solr.common.util.NamedList;-import org.hamcrest.MatcherAssert;import org.junit.Test;import org.slf4j.Logger;import org.slf4j.LoggerFactory;@@ -178,7 +177,7 @@ public class TestRequestStatusCollectionAPI extends BasicDistributedZkTest {() -> {sendRequest(duplicateRequestIdParams);});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(), containsString("Task with the same requestid already exists. (1002)"));}diff --git a/solr/core/src/test/org/apache/solr/cluster/placement/impl/NodeConfigPlacementPluginTest.java b/solr/core/src/test/org/apache/solr/cluster/placement/impl/NodeConfigPlacementPluginTest.javaindex 8608c14c887..f607479caeb 100644--- a/solr/core/src/test/org/apache/solr/cluster/placement/impl/NodeConfigPlacementPluginTest.java+++ b/solr/core/src/test/org/apache/solr/cluster/placement/impl/NodeConfigPlacementPluginTest.java@@ -25,7 +25,6 @@ import org.apache.solr.cloud.SolrCloudTestCase;import org.apache.solr.cluster.placement.plugins.AffinityPlacementConfig;import org.apache.solr.cluster.placement.plugins.AffinityPlacementFactory;import org.apache.solr.core.CoreContainer;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;@@ -48,10 +47,10 @@ public class NodeConfigPlacementPluginTest extends SolrCloudTestCase {@Testpublic void testConfigurationInSolrXml() {CoreContainer cc = cluster.getJettySolrRunner(0).getCoreContainer();- MatcherAssert.assertThat(+ assertThat(cc.getPlacementPluginFactory().createPluginInstance(),instanceOf(AffinityPlacementFactory.AffinityPlacementPlugin.class));- MatcherAssert.assertThat(+ assertThat(cc.getPlacementPluginFactory().getConfig(), instanceOf(AffinityPlacementConfig.class));AffinityPlacementConfig config =diff --git a/solr/core/src/test/org/apache/solr/cluster/placement/impl/PlacementPluginIntegrationTest.java b/solr/core/src/test/org/apache/solr/cluster/placement/impl/PlacementPluginIntegrationTest.javaindex cb1cd6600c0..6c1aec5271e 100644--- a/solr/core/src/test/org/apache/solr/cluster/placement/impl/PlacementPluginIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/cluster/placement/impl/PlacementPluginIntegrationTest.java@@ -59,7 +59,6 @@ import org.apache.solr.common.cloud.ClusterState;import org.apache.solr.common.cloud.DocCollection;import org.apache.solr.core.CoreContainer;import org.apache.solr.util.LogLevel;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.BeforeClass;import org.junit.Rule;@@ -108,7 +107,7 @@ public class PlacementPluginIntegrationTest extends SolrCloudTestCase {@Testpublic void testDefaultConfiguration() {CoreContainer cc = createCoreContainer(TEST_PATH(), "<solr></solr>");- MatcherAssert.assertThat(+ assertThat(cc.getPlacementPluginFactory().createPluginInstance(),instanceOf(SimplePlacementFactory.SimplePlacementPlugin.class));cc.shutdown();@@ -118,7 +117,7 @@ public class PlacementPluginIntegrationTest extends SolrCloudTestCase {public void testConfigurationInSystemProps() {System.setProperty(PlacementPluginFactoryLoader.PLACEMENTPLUGIN_DEFAULT_SYSPROP, "random");CoreContainer cc = createCoreContainer(TEST_PATH(), "<solr></solr>");- MatcherAssert.assertThat(+ assertThat(cc.getPlacementPluginFactory().createPluginInstance(),instanceOf(RandomPlacementFactory.RandomPlacementPlugin.class));cc.shutdown();diff --git a/solr/core/src/test/org/apache/solr/common/util/TestObjectReleaseTracker.java b/solr/core/src/test/org/apache/solr/common/util/TestObjectReleaseTracker.javaindex e5b3ce53dbd..0f7fa9d044e 100644--- a/solr/core/src/test/org/apache/solr/common/util/TestObjectReleaseTracker.java+++ b/solr/core/src/test/org/apache/solr/common/util/TestObjectReleaseTracker.java@@ -25,7 +25,6 @@ import java.util.concurrent.Future;import java.util.concurrent.TimeUnit;import java.util.concurrent.atomic.AtomicReference;import org.apache.solr.SolrTestCaseJ4;-import org.hamcrest.MatcherAssert;import org.junit.Test;public class TestObjectReleaseTracker extends SolrTestCaseJ4 {@@ -80,7 +79,7 @@ public class TestObjectReleaseTracker extends SolrTestCaseJ4 {public void testAnonymousClasses() {ObjectReleaseTracker.track(new Object() {});String message = ObjectReleaseTracker.clearObjectTrackerAndCheckEmpty();- MatcherAssert.assertThat(message, containsString("[Object]"));+ assertThat(message, containsString("[Object]"));}@Test@@ -97,7 +96,7 @@ public class TestObjectReleaseTracker extends SolrTestCaseJ4 {result.get(); // make sure that track has been calledString message = ObjectReleaseTracker.clearObjectTrackerAndCheckEmpty();- MatcherAssert.assertThat(+ assertThat(message,stringContainsInOrder(ObjectReleaseTracker.ObjectTrackerException.class.getName(),@@ -118,7 +117,7 @@ public class TestObjectReleaseTracker extends SolrTestCaseJ4 {result.get();indirectResult.get().get();message = ObjectReleaseTracker.clearObjectTrackerAndCheckEmpty();- MatcherAssert.assertThat(+ assertThat(message,stringContainsInOrder(ObjectReleaseTracker.ObjectTrackerException.class.getName(),@@ -145,7 +144,7 @@ public class TestObjectReleaseTracker extends SolrTestCaseJ4 {indirectResult.get().get();indirectIndirect.get().get();message = ObjectReleaseTracker.clearObjectTrackerAndCheckEmpty();- MatcherAssert.assertThat(+ assertThat(message,stringContainsInOrder(ObjectReleaseTracker.ObjectTrackerException.class.getName(),diff --git a/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java b/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.javaindex 1e81af74233..39a992eb3ea 100644--- a/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java+++ b/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java@@ -45,7 +45,6 @@ import org.apache.solr.handler.admin.LukeRequestHandler;import org.apache.solr.handler.component.FacetComponent;import org.apache.solr.response.JSONResponseWriter;import org.apache.solr.util.plugin.SolrCoreAware;-import org.hamcrest.MatcherAssert;import org.junit.After;public class ResourceLoaderTest extends SolrTestCaseJ4 {@@ -59,7 +58,7 @@ public class ResourceLoaderTest extends SolrTestCaseJ4 {public void testInstanceDir() throws Exception {final Path dir = createTempDir();try (SolrResourceLoader loader = new SolrResourceLoader(dir.toAbsolutePath())) {- MatcherAssert.assertThat(loader.getInstancePath(), is(dir.toAbsolutePath()));+ assertThat(loader.getInstancePath(), is(dir.toAbsolutePath()));}}diff --git a/solr/core/src/test/org/apache/solr/core/TestConfigSets.java b/solr/core/src/test/org/apache/solr/core/TestConfigSets.javaindex 29cc1f16a17..df9d72cb508 100644--- a/solr/core/src/test/org/apache/solr/core/TestConfigSets.java+++ b/solr/core/src/test/org/apache/solr/core/TestConfigSets.java@@ -30,7 +30,6 @@ import java.nio.file.StandardCopyOption;import java.util.Map;import org.apache.commons.io.file.PathUtils;import org.apache.solr.SolrTestCaseJ4;-import org.hamcrest.MatcherAssert;import org.junit.Rule;import org.junit.Test;import org.junit.rules.RuleChain;@@ -61,14 +60,14 @@ public class TestConfigSets extends SolrTestCaseJ4 {NodeConfig config =SolrXmlConfig.fromString(solrHome, "<solr><str name=\"configSetBaseDir\">configsets</str></solr>");- MatcherAssert.assertThat(+ assertThat(config.getConfigSetBaseDirectory().toAbsolutePath(),is(Paths.get("/path/to/solr/home/configsets").toAbsolutePath()));NodeConfig absConfig =SolrXmlConfig.fromString(solrHome, "<solr><str name=\"configSetBaseDir\">/path/to/configsets</str></solr>");- MatcherAssert.assertThat(+ assertThat(absConfig.getConfigSetBaseDirectory().toAbsolutePath(),is(Paths.get("/path/to/configsets").toAbsolutePath()));}@@ -81,8 +80,8 @@ public class TestConfigSets extends SolrTestCaseJ4 {Path solrHome = Paths.get(container.getSolrHome());SolrCore core1 = container.create("core1", Map.of("configSet", "configset-2"));- MatcherAssert.assertThat(core1.getCoreDescriptor().getName(), is("core1"));- MatcherAssert.assertThat(+ assertThat(core1.getCoreDescriptor().getName(), is("core1"));+ assertThat(Paths.get(core1.getDataDir()).toString(),is(solrHome.resolve("core1").resolve("data").toString()));} finally {@@ -102,7 +101,7 @@ public class TestConfigSets extends SolrTestCaseJ4 {container.create("core1", Map.of("configSet", "nonexistent"));});Throwable wrappedException = getWrappedException(thrown);- MatcherAssert.assertThat(wrappedException.getMessage(), containsString("nonexistent"));+ assertThat(wrappedException.getMessage(), containsString("nonexistent"));} finally {if (container != null) container.shutdown();}@@ -123,7 +122,7 @@ public class TestConfigSets extends SolrTestCaseJ4 {// We initially don't have a /dump handler definedSolrCore core = container.create("core1", Map.of("configSet", "configset-2"));- MatcherAssert.assertThat(+ assertThat("No /dump handler should be defined in the initial configuration",core.getRequestHandler("/dump"),is(nullValue()));@@ -136,7 +135,7 @@ public class TestConfigSets extends SolrTestCaseJ4 {container.reload("core1");core = container.getCore("core1");- MatcherAssert.assertThat(+ assertThat("A /dump handler should be defined in the reloaded configuration",core.getRequestHandler("/dump"),is(notNullValue()));diff --git a/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java b/solr/core/src/test/org/apache/solr/core/TestCoreContainer.javaindex e0d20b391c6..b8405fba6b0 100644--- a/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java+++ b/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java@@ -47,7 +47,6 @@ import org.apache.solr.handler.admin.CoreAdminHandler;import org.apache.solr.handler.admin.InfoHandler;import org.apache.solr.servlet.SolrDispatchFilter;import org.apache.solr.util.ModuleUtils;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.Assume;import org.junit.BeforeClass;@@ -288,7 +287,7 @@ public class TestCoreContainer extends SolrTestCaseJ4 {() -> {cores.unload("non_existent_core");});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),containsString("Cannot unload non-existent core [non_existent_core]"));@@ -299,8 +298,7 @@ public class TestCoreContainer extends SolrTestCaseJ4 {() -> {cores.unload(null);});- MatcherAssert.assertThat(- thrown.getMessage(), containsString("Cannot unload non-existent core [null]"));+ assertThat(thrown.getMessage(), containsString("Cannot unload non-existent core [null]"));} finally {cores.shutdown();}@@ -334,16 +332,16 @@ public class TestCoreContainer extends SolrTestCaseJ4 {try {cc.load();- MatcherAssert.assertThat(cc.getCoreInitFailures().size(), is(1));- MatcherAssert.assertThat(+ assertThat(cc.getCoreInitFailures().size(), is(1));+ assertThat(cc.getCoreInitFailures().get("badcore").exception.getMessage(),containsString("nosuchconfigset"));cc.unload("badcore", true, true, true);- MatcherAssert.assertThat(cc.getCoreInitFailures().size(), is(0));+ assertThat(cc.getCoreInitFailures().size(), is(0));// can we create the core now with a good config?SolrCore core = cc.create("badcore", Map.of("configSet", "minimal"));- MatcherAssert.assertThat(core, not(nullValue()));+ assertThat(core, not(nullValue()));} finally {cc.shutdown();@@ -749,11 +747,9 @@ public class TestCoreContainer extends SolrTestCaseJ4 {CoreContainer cc = init(CUSTOM_HANDLERS_SOLR_XML);try {- MatcherAssert.assertThat(- cc.getCollectionsHandler(), is(instanceOf(CustomCollectionsHandler.class)));- MatcherAssert.assertThat(cc.getInfoHandler(), is(instanceOf(CustomInfoHandler.class)));- MatcherAssert.assertThat(- cc.getMultiCoreHandler(), is(instanceOf(CustomCoreAdminHandler.class)));+ assertThat(cc.getCollectionsHandler(), is(instanceOf(CustomCollectionsHandler.class)));+ assertThat(cc.getInfoHandler(), is(instanceOf(CustomInfoHandler.class)));+ assertThat(cc.getMultiCoreHandler(), is(instanceOf(CustomCoreAdminHandler.class)));} finally {cc.shutdown();}@@ -763,8 +759,7 @@ public class TestCoreContainer extends SolrTestCaseJ4 {public void testCustomConfigSetService() throws Exception {CoreContainer cc = init(CUSTOM_CONFIG_SET_SERVICE_SOLR_XML);try {- MatcherAssert.assertThat(- cc.getConfigSetService(), is(instanceOf(CustomConfigSetService.class)));+ assertThat(cc.getConfigSetService(), is(instanceOf(CustomConfigSetService.class)));} finally {cc.shutdown();}diff --git a/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java b/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.javaindex 44cd51b6c41..6f763537b72 100644--- a/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java+++ b/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java@@ -39,7 +39,6 @@ import org.apache.lucene.util.IOUtils;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.SolrException;import org.apache.solr.common.util.RetryUtil;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.BeforeClass;import org.junit.Test;@@ -462,8 +461,7 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {assertNull(cc.getCore("core0"));SolrCore core3 = cc.create("core3", Map.of("configSet", "minimal"));- MatcherAssert.assertThat(- core3.getCoreDescriptor().getInstanceDir().toString(), containsString("relative"));+ assertThat(core3.getCoreDescriptor().getInstanceDir().toString(), containsString("relative"));} finally {cc.shutdown();@@ -616,8 +614,7 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {if (cc != null) cc.shutdown();}});- MatcherAssert.assertThat(- thrown.getMessage(), containsString("Error reading core root directory"));+ assertThat(thrown.getMessage(), containsString("Error reading core root directory"));// So things can be cleaned up by the framework!homeDir.setReadable(true, false);}@@ -641,14 +638,14 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {NodeConfig config =SolrXmlConfig.fromString(solrHomeDirectory, "<solr><str name=\"coreRootDirectory\">relative</str></solr>");- MatcherAssert.assertThat(+ assertThat(config.getCoreRootDirectory().toString(),containsString(solrHomeDirectory.toAbsolutePath().toString()));NodeConfig absConfig =SolrXmlConfig.fromString(solrHomeDirectory, "<solr><str name=\"coreRootDirectory\">/absolute</str></solr>");- MatcherAssert.assertThat(+ assertThat(absConfig.getCoreRootDirectory().toString(),not(containsString(solrHomeDirectory.toAbsolutePath().toString())));}diff --git a/solr/core/src/test/org/apache/solr/core/TestSchemaCodecFactoryDefaults.java b/solr/core/src/test/org/apache/solr/core/TestSchemaCodecFactoryDefaults.javaindex 2db049ba013..8f27aa930c9 100644--- a/solr/core/src/test/org/apache/solr/core/TestSchemaCodecFactoryDefaults.java+++ b/solr/core/src/test/org/apache/solr/core/TestSchemaCodecFactoryDefaults.java@@ -27,7 +27,6 @@ import java.util.Set;import org.apache.lucene.codecs.Codec;import org.apache.lucene.tests.util.TestUtil;import org.apache.solr.SolrTestCaseJ4;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;/**@@ -55,12 +54,12 @@ public class TestSchemaCodecFactoryDefaults extends SolrTestCaseJ4 {"Someone broke test config so it declares a CodecFactory, making this test useless",h.getCore().getSolrConfig().getPluginInfo(CodecFactory.class.getName()));- MatcherAssert.assertThat(+ assertThat("WTF: SolrCore's implicit default Codec is literally same object as Lucene default?",h.getCore().getCodec(),not(sameInstance(LUCENE_DEFAULT_CODEC)));- MatcherAssert.assertThat(+ assertThat("WTF: SolrCore's Codec is literally same object as Lucene (test randomixed) default?",h.getCore().getCodec(),not(sameInstance(Codec.getDefault())));@@ -68,14 +67,14 @@ public class TestSchemaCodecFactoryDefaults extends SolrTestCaseJ4 {// TODO: it would be nice if we could assert something like 'instanceOf(SchemaCodec.class)'// But making that kind of assertion would require refactoring SchemaCodecFactory// to return an instance of a concreate (named) class -- right now it's anonymous...- MatcherAssert.assertThat(+ assertThat("WTF: SolrCore's implicit default Codec is not anon impl from SchemaCodecFactory",h.getCore().getCodec().getClass().getName(),containsString(".SchemaCodecFactory$"));}public void testSubclass() {- MatcherAssert.assertThat(+ assertThat("SchemaCodec does not extend current default lucene codec",h.getCore().getCodec(),instanceOf(LUCENE_DEFAULT_CODEC.getClass()));diff --git a/solr/core/src/test/org/apache/solr/core/TestSolrXml.java b/solr/core/src/test/org/apache/solr/core/TestSolrXml.javaindex 5454baceb86..55769fc369b 100644--- a/solr/core/src/test/org/apache/solr/core/TestSolrXml.java+++ b/solr/core/src/test/org/apache/solr/core/TestSolrXml.java@@ -40,7 +40,6 @@ import org.apache.solr.search.SolrCache;import org.apache.solr.search.TestThinCache;import org.apache.solr.search.ThinCache;import org.apache.solr.update.UpdateShardHandlerConfig;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.Ignore;@@ -86,7 +85,7 @@ public class TestSolrXml extends SolrTestCaseJ4 {assertEquals("core sorter class", "testCoreSorter", cfg.getCoreSorterClass());assertEquals("core load threads", 11, cfg.getCoreLoadThreadCount(false));assertEquals("replay update threads", 100, cfg.getReplayUpdatesThreads());- MatcherAssert.assertThat(+ assertThat("core root dir",cfg.getCoreRootDirectory().toString(),containsString("testCoreRootDirectory"));@@ -177,7 +176,7 @@ public class TestSolrXml extends SolrTestCaseJ4 {Files.copy(testSrcRoot.resolve("solr-50-all.xml"), solrHome.resolve("solr.xml"));NodeConfig cfg = SolrXmlConfig.fromSolrHome(solrHome, new Properties());- MatcherAssert.assertThat(cfg.getCoreRootDirectory().toString(), containsString("myCoreRoot"));+ assertThat(cfg.getCoreRootDirectory().toString(), containsString("myCoreRoot"));assertEquals("solr host port", 8888, cfg.getCloudConfig().getSolrHostPort());assertFalse("schema cache", cfg.hasSchemaCache());}diff --git a/solr/core/src/test/org/apache/solr/filestore/TestDistribFileStore.java b/solr/core/src/test/org/apache/solr/filestore/TestDistribFileStore.javaindex 0b300836437..a6fa83b579c 100644--- a/solr/core/src/test/org/apache/solr/filestore/TestDistribFileStore.java+++ b/solr/core/src/test/org/apache/solr/filestore/TestDistribFileStore.java@@ -54,7 +54,6 @@ import org.apache.solr.embedded.JettySolrRunner;import org.apache.solr.packagemanager.PackageUtils;import org.apache.solr.util.LogLevel;import org.apache.zookeeper.server.ByteBufferInputStream;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.Before;import org.junit.Test;@@ -96,7 +95,7 @@ public class TestDistribFileStore extends SolrCloudTestCase {"j+Rflxi64tXdqosIhbusqi6GTwZq8znunC/dzwcWW0/dHlFGKDurOaE1Nz9FSPJuXbHkVLj638yZ0Lp1ssnoYA==");fail("should have failed because of wrong signature ");} catch (RemoteExecutionException e) {- MatcherAssert.assertThat(e.getMessage(), containsString("Signature does not match"));+ assertThat(e.getMessage(), containsString("Signature does not match"));}postFile(diff --git a/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.java b/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.javaindex b311886c5fd..eabadb80ac8 100644--- a/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.java+++ b/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.java@@ -64,7 +64,6 @@ import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.response.SolrQueryResponse;import org.apache.solr.security.PermissionNameProvider;import org.apache.solr.util.ErrorLogMuter;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.Before;import org.junit.Test;@@ -218,7 +217,7 @@ public class TestContainerPlugin extends SolrCloudTestCase {() -> getPlugin("/my-random-prefix/their/plugin").call());assertEquals(404, e.code());final String msg = (String) ((Map<String, Object>) (e.getMetaData().get("error"))).get("msg");- MatcherAssert.assertThat(msg, containsString("Cannot find API for the path"));+ assertThat(msg, containsString("Cannot find API for the path"));// test ClusterSingleton pluginCConfig c6Cfg = new CConfig();diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.javaindex fc7c8e352d1..c35f5c88069 100644--- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java+++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java@@ -74,7 +74,6 @@ import org.apache.solr.embedded.JettySolrRunner;import org.apache.solr.security.AllowListUrlChecker;import org.apache.solr.util.TestInjection;import org.apache.solr.util.TimeOut;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.Before;import org.junit.BeforeClass;@@ -1579,8 +1578,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {followerClient.query(q);});assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, thrown.code());- MatcherAssert.assertThat(- thrown.getMessage(), containsString("Missing required parameter: command"));+ assertThat(thrown.getMessage(), containsString("Missing required parameter: command"));}@Test@@ -1594,8 +1592,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {followerClient.query(q);});assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, thrown.code());- MatcherAssert.assertThat(- thrown.getMessage(), containsString("Missing required parameter: name"));+ assertThat(thrown.getMessage(), containsString("Missing required parameter: name"));}@Testdiff --git a/solr/core/src/test/org/apache/solr/handler/TestRequestId.java b/solr/core/src/test/org/apache/solr/handler/TestRequestId.javaindex bd94182719c..e8692ce1d38 100644--- a/solr/core/src/test/org/apache/solr/handler/TestRequestId.java+++ b/solr/core/src/test/org/apache/solr/handler/TestRequestId.java@@ -25,7 +25,6 @@ import org.apache.solr.common.params.CommonParams;import org.apache.solr.common.util.SuppressForbidden;import org.apache.solr.core.SolrCore;import org.apache.solr.util.LogListener;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.slf4j.MDC;@@ -76,7 +75,7 @@ public class TestRequestId extends SolrTestCaseJ4 {var reqEvent = reqLog.getQueue().poll();assertNotNull(reqEvent);assertEquals("yyy", reqEvent.getContextData().getValue("rid"));- MatcherAssert.assertThat(+ assertThat(reqEvent.getMessage().getFormattedMessage(),containsString("status=" + ErrorCode.BAD_REQUEST.code));}diff --git a/solr/core/src/test/org/apache/solr/handler/admin/ZookeeperReadAPITest.java b/solr/core/src/test/org/apache/solr/handler/admin/ZookeeperReadAPITest.javaindex 109e27d64d9..e77290dc230 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/ZookeeperReadAPITest.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/ZookeeperReadAPITest.java@@ -30,7 +30,6 @@ import org.apache.solr.cloud.SolrCloudTestCase;import org.apache.solr.common.SolrException;import org.apache.solr.common.util.Utils;import org.apache.zookeeper.CreateMode;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.Before;import org.junit.BeforeClass;@@ -147,7 +146,7 @@ public class ZookeeperReadAPITest extends SolrCloudTestCase {final Map<String, ZookeeperReadAPI.AnnotatedStat> childStatsByPath =response.unknownProperties().get("/configs/_default");assertEquals(6, childStatsByPath.size());- MatcherAssert.assertThat(+ assertThat(childStatsByPath.keySet(),containsInAnyOrder("protwords.txt",diff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/CreateAliasAPITest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/CreateAliasAPITest.javaindex 1e97d61a543..e7d1ff89001 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/api/CreateAliasAPITest.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/api/CreateAliasAPITest.java@@ -27,7 +27,6 @@ import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.client.api.model.CreateCollectionRequestBody;import org.apache.solr.common.SolrException;import org.apache.solr.common.params.ModifiableSolrParams;-import org.hamcrest.MatcherAssert;import org.junit.Test;/** Unit tests for {@link CreateAliasAPI} */@@ -54,9 +53,9 @@ public class CreateAliasAPITest extends SolrTestCaseJ4 {requestBody.collections = List.of("validColl1", "validColl2");final var thrown = expectThrows(SolrException.class, () -> requestBody.validate());- MatcherAssert.assertThat(thrown.getMessage(), containsString("Invalid alias"));- MatcherAssert.assertThat(thrown.getMessage(), containsString("some@invalid$alias"));- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(), containsString("Invalid alias"));+ assertThat(thrown.getMessage(), containsString("some@invalid$alias"));+ assertThat(thrown.getMessage(),containsString("alias names must consist entirely of periods, underscores, hyphens, and alphanumerics"));@@ -102,7 +101,7 @@ public class CreateAliasAPITest extends SolrTestCaseJ4 {final var thrown = expectThrows(SolrException.class, () -> requestBody.validate());assertEquals(400, thrown.code());- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(), containsString("Routed alias creation requires a configset name"));}@@ -124,7 +123,7 @@ public class CreateAliasAPITest extends SolrTestCaseJ4 {final var thrown = expectThrows(SolrException.class, () -> requestBody.validate());assertEquals(400, thrown.code());- MatcherAssert.assertThat(thrown.getMessage(), containsString("cannot specify the name"));+ assertThat(thrown.getMessage(), containsString("cannot specify the name"));}@Testdiff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/CreateCollectionSnapshotAPITest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/CreateCollectionSnapshotAPITest.javaindex affbbf4266e..27efa7bc0ef 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/api/CreateCollectionSnapshotAPITest.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/api/CreateCollectionSnapshotAPITest.java@@ -26,7 +26,6 @@ import java.util.Map;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.cloud.ZkNodeProps;import org.apache.solr.common.params.CoreAdminParams;-import org.hamcrest.MatcherAssert;import org.junit.Test;public class CreateCollectionSnapshotAPITest extends SolrTestCaseJ4 {@@ -37,7 +36,7 @@ public class CreateCollectionSnapshotAPITest extends SolrTestCaseJ4 {CreateCollectionSnapshot.createRemoteMessage("myCollName", false, "mySnapshotName", null);final Map<String, Object> rawMessageOne = messageOne.getProperties();assertEquals(4, rawMessageOne.size());- MatcherAssert.assertThat(+ assertThat(rawMessageOne.keySet(),containsInAnyOrder(QUEUE_OPERATION, COLLECTION_PROP, CoreAdminParams.COMMIT_NAME, FOLLOW_ALIASES));@@ -51,7 +50,7 @@ public class CreateCollectionSnapshotAPITest extends SolrTestCaseJ4 {"myCollName", true, "mySnapshotName", "myAsyncId");final Map<String, Object> rawMessageTwo = messageTwo.getProperties();assertEquals(5, rawMessageTwo.size());- MatcherAssert.assertThat(+ assertThat(rawMessageTwo.keySet(),containsInAnyOrder(QUEUE_OPERATION, COLLECTION_PROP, CoreAdminParams.COMMIT_NAME, FOLLOW_ALIASES, ASYNC));diff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/CreateShardAPITest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/CreateShardAPITest.javaindex bb89fd326b5..a8bc3edf658 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/api/CreateShardAPITest.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/api/CreateShardAPITest.java@@ -36,7 +36,6 @@ import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.client.api.model.CreateShardRequestBody;import org.apache.solr.common.SolrException;import org.apache.solr.common.params.ModifiableSolrParams;-import org.hamcrest.MatcherAssert;import org.junit.Test;/** Unit tests for {@link CreateShard} */@@ -101,8 +100,7 @@ public class CreateShardAPITest extends SolrTestCaseJ4 {});assertEquals(400, thrown.code());- MatcherAssert.assertThat(- thrown.getMessage(), containsString("Invalid shard: [invalid$shard@name]"));+ assertThat(thrown.getMessage(), containsString("Invalid shard: [invalid$shard@name]"));}@Testdiff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/DeleteCollectionAPITest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/DeleteCollectionAPITest.javaindex 60f2dccff19..fafc0a67c00 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/api/DeleteCollectionAPITest.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/api/DeleteCollectionAPITest.java@@ -26,7 +26,6 @@ import static org.hamcrest.Matchers.containsInAnyOrder;import java.util.Map;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.cloud.ZkNodeProps;-import org.hamcrest.MatcherAssert;import org.junit.Test;/** Unit tests for {@link DeleteCollection} */@@ -39,7 +38,7 @@ public class DeleteCollectionAPITest extends SolrTestCaseJ4 {final ZkNodeProps message = DeleteCollection.createRemoteMessage("someCollName", null, null);final Map<String, Object> rawMessage = message.getProperties();assertEquals(2, rawMessage.size());- MatcherAssert.assertThat(rawMessage.keySet(), containsInAnyOrder(QUEUE_OPERATION, NAME));+ assertThat(rawMessage.keySet(), containsInAnyOrder(QUEUE_OPERATION, NAME));assertEquals("delete", rawMessage.get(QUEUE_OPERATION));assertEquals("someCollName", rawMessage.get(NAME));}@@ -50,7 +49,7 @@ public class DeleteCollectionAPITest extends SolrTestCaseJ4 {DeleteCollection.createRemoteMessage("someCollName", Boolean.TRUE, "someAsyncId");final Map<String, Object> rawMessage = message.getProperties();assertEquals(4, rawMessage.size());- MatcherAssert.assertThat(+ assertThat(rawMessage.keySet(), containsInAnyOrder(QUEUE_OPERATION, NAME, ASYNC, FOLLOW_ALIASES));assertEquals("delete", rawMessage.get(QUEUE_OPERATION));assertEquals("someCollName", rawMessage.get(NAME));diff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/DeleteCollectionSnapshotAPITest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/DeleteCollectionSnapshotAPITest.javaindex d6e1769e09c..0ed8e42c12c 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/api/DeleteCollectionSnapshotAPITest.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/api/DeleteCollectionSnapshotAPITest.java@@ -26,7 +26,6 @@ import java.util.Map;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.cloud.ZkNodeProps;import org.apache.solr.common.params.CoreAdminParams;-import org.hamcrest.MatcherAssert;import org.junit.Test;public class DeleteCollectionSnapshotAPITest extends SolrTestCaseJ4 {@@ -37,7 +36,7 @@ public class DeleteCollectionSnapshotAPITest extends SolrTestCaseJ4 {DeleteCollectionSnapshot.createRemoteMessage("myCollName", false, "mySnapshotName", null);final Map<String, Object> rawMessageOne = messageOne.getProperties();assertEquals(4, rawMessageOne.size());- MatcherAssert.assertThat(+ assertThat(rawMessageOne.keySet(),containsInAnyOrder(QUEUE_OPERATION, COLLECTION_PROP, CoreAdminParams.COMMIT_NAME, FOLLOW_ALIASES));@@ -51,7 +50,7 @@ public class DeleteCollectionSnapshotAPITest extends SolrTestCaseJ4 {"myCollName", true, "mySnapshotName", "myAsyncId");final Map<String, Object> rawMessageTwo = messageTwo.getProperties();assertEquals(5, rawMessageTwo.size());- MatcherAssert.assertThat(+ assertThat(rawMessageTwo.keySet(),containsInAnyOrder(QUEUE_OPERATION, COLLECTION_PROP, CoreAdminParams.COMMIT_NAME, FOLLOW_ALIASES, ASYNC));diff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/NodeLoggingAPITest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/NodeLoggingAPITest.javaindex 3a3e7c32707..1572812cb06 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/api/NodeLoggingAPITest.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/api/NodeLoggingAPITest.java@@ -32,7 +32,6 @@ import org.apache.solr.common.SolrDocumentList;import org.apache.solr.core.CoreContainer;import org.apache.solr.logging.LogWatcher;import org.apache.solr.logging.LoggerInfo;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.BeforeClass;import org.junit.Test;@@ -65,8 +64,7 @@ public class NodeLoggingAPITest extends SolrTestCase {final var responseBody = new NodeLoggingAPI(mockCoreContainer).listAllLoggersAndLevels();assertEquals(5, responseBody.levels.size());- MatcherAssert.assertThat(- responseBody.levels, containsInAnyOrder("ERROR", "WARN", "INFO", "DEBUG", "TRACE"));+ assertThat(responseBody.levels, containsInAnyOrder("ERROR", "WARN", "INFO", "DEBUG", "TRACE"));assertEquals(2, responseBody.loggers.size());final var firstLogger = responseBody.loggers.get(0);diff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/RestoreCollectionAPITest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/RestoreCollectionAPITest.javaindex d4a303f2599..17416f95786 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/api/RestoreCollectionAPITest.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/api/RestoreCollectionAPITest.java@@ -38,7 +38,6 @@ import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.client.api.model.CreateCollectionRequestBody;import org.apache.solr.common.SolrException;import org.apache.solr.common.params.ModifiableSolrParams;-import org.hamcrest.MatcherAssert;import org.junit.Test;/** Unit tests for {@link RestoreCollectionAPI} */@@ -103,7 +102,7 @@ public class RestoreCollectionAPITest extends SolrTestCaseJ4 {});assertEquals(400, thrown.code());- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(), containsString("Invalid collection: [invalid$collection@name]"));}diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetExistsSmallTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetExistsSmallTest.javaindex 2f4212b7d88..5b7d2025687 100644--- a/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetExistsSmallTest.java+++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetExistsSmallTest.java@@ -26,7 +26,6 @@ import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrException.ErrorCode;import org.apache.solr.common.params.ModifiableSolrParams;-import org.hamcrest.MatcherAssert;import org.junit.Before;public class DistributedFacetExistsSmallTest extends BaseDistributedSearchTestCase {@@ -221,13 +220,13 @@ public class DistributedFacetExistsSmallTest extends BaseDistributedSearchTestCaprivate void assertResponse(QueryResponse rsp) {final FacetField facetField = rsp.getFacetField(FLD);- MatcherAssert.assertThat(facetField.getValueCount(), is(6));+ assertThat(facetField.getValueCount(), is(6));final List<FacetField.Count> counts = facetField.getValues();for (FacetField.Count count : counts) {- MatcherAssert.assertThat("Count for: " + count.getName(), count.getCount(), is(1L));+ assertThat("Count for: " + count.getName(), count.getCount(), is(1L));}- MatcherAssert.assertThat(counts.get(0).getName(), is("AAA"));- MatcherAssert.assertThat(counts.get(1).getName(), is("B"));- MatcherAssert.assertThat(counts.get(2).getName(), is("BB"));+ assertThat(counts.get(0).getName(), is("AAA"));+ assertThat(counts.get(1).getName(), is("B"));+ assertThat(counts.get(2).getName(), is("BB"));}}diff --git a/solr/core/src/test/org/apache/solr/handler/component/PhrasesIdentificationComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/PhrasesIdentificationComponentTest.javaindex ed3fd4a9880..b21810b20e9 100644--- a/solr/core/src/test/org/apache/solr/handler/component/PhrasesIdentificationComponentTest.java+++ b/solr/core/src/test/org/apache/solr/handler/component/PhrasesIdentificationComponentTest.java@@ -36,7 +36,6 @@ import org.apache.solr.handler.component.PhrasesIdentificationComponent.Phrase;import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.schema.IndexSchema;import org.apache.solr.schema.SchemaField;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.Before;import org.junit.BeforeClass;@@ -470,11 +469,10 @@ public class PhrasesIdentificationComponentTest extends SolrTestCaseJ4 {// "brown fox" should score positively in both fields, and overall...final Phrase brown_fox = phrases.get(8);assertEquals("BROWN fox", brown_fox.getSubSequence().toString());- MatcherAssert.assertThat(+ assertThat(brown_fox.toString(), brown_fox.getFieldScore("multigrams_title"), greaterThan(0.0D));- MatcherAssert.assertThat(- brown_fox.toString(), brown_fox.getFieldScore("multigrams_body"), greaterThan(0.0D));- MatcherAssert.assertThat(brown_fox.toString(), brown_fox.getTotalScore(), greaterThan(0.0D));+ assertThat(brown_fox.toString(), brown_fox.getFieldScore("multigrams_body"), greaterThan(0.0D));+ assertThat(brown_fox.toString(), brown_fox.getTotalScore(), greaterThan(0.0D));// "we lazy" does appear in a title value, but should score poorly given how often the terms// are used in other contexts, and should score -1 against body -- but because of our weights,@@ -483,9 +481,8 @@ public class PhrasesIdentificationComponentTest extends SolrTestCaseJ4 {assertEquals("we lAzY", we_lazy.getSubSequence().toString());assertEquals(we_lazy.toString(), -1.0D, we_lazy.getFieldScore("multigrams_body"), 0.0D);- MatcherAssert.assertThat(- we_lazy.toString(), we_lazy.getFieldScore("multigrams_title"), lessThan(0.0D));- MatcherAssert.assertThat(we_lazy.toString(), we_lazy.getTotalScore(), lessThan(0.0D));+ assertThat(we_lazy.toString(), we_lazy.getFieldScore("multigrams_title"), lessThan(0.0D));+ assertThat(we_lazy.toString(), we_lazy.getTotalScore(), lessThan(0.0D));assertEquals(we_lazy.toString(),we_lazy.getFieldScore("multigrams_title"),@@ -498,9 +495,8 @@ public class PhrasesIdentificationComponentTest extends SolrTestCaseJ4 {final Phrase wawl = phrases.get(phrases.size() - 7);assertEquals("why are we lAzY", wawl.getSubSequence().toString());assertEquals(wawl.toString(), -1.0D, wawl.getFieldScore("multigrams_body"), 0.0D);- MatcherAssert.assertThat(- wawl.toString(), wawl.getFieldScore("multigrams_title"), greaterThan(0.0D));- MatcherAssert.assertThat(wawl.toString(), wawl.getTotalScore(), greaterThan(0.0D));+ assertThat(wawl.toString(), wawl.getFieldScore("multigrams_title"), greaterThan(0.0D));+ assertThat(wawl.toString(), wawl.getTotalScore(), greaterThan(0.0D));assertEquals(wawl.toString(), wawl.getFieldScore("multigrams_title"), wawl.getTotalScore(), 0.0D);@@ -534,7 +530,7 @@ public class PhrasesIdentificationComponentTest extends SolrTestCaseJ4 {// about stop words, but the stopword field should reject themfinal Phrase why_the_lazy = phrases.get(2);assertEquals("why the lazy", why_the_lazy.getSubSequence().toString());- MatcherAssert.assertThat(+ assertThat(why_the_lazy.toString(),why_the_lazy.getFieldScore("multigrams_title"),greaterThan(0.0D));@@ -546,7 +542,7 @@ public class PhrasesIdentificationComponentTest extends SolrTestCaseJ4 {final Phrase the_lazy_dog = phrases.get(8);assertEquals("the lazy dog", the_lazy_dog.getSubSequence().toString());- MatcherAssert.assertThat(+ assertThat(the_lazy_dog.toString(),the_lazy_dog.getFieldScore("multigrams_title"),greaterThan(0.0D));@@ -560,13 +556,13 @@ public class PhrasesIdentificationComponentTest extends SolrTestCaseJ4 {// "brown fox" should score positively in both fields, and overall...final Phrase brown_fox = phrases.get(phrases.size() - 2);assertEquals("brown fox", brown_fox.getSubSequence().toString());- MatcherAssert.assertThat(+ assertThat(brown_fox.toString(), brown_fox.getFieldScore("multigrams_title"), greaterThan(0.0D));- MatcherAssert.assertThat(+ assertThat(brown_fox.toString(),brown_fox.getFieldScore("multigrams_title_stop"),greaterThan(0.0D));- MatcherAssert.assertThat(brown_fox.toString(), brown_fox.getTotalScore(), greaterThan(0.0D));+ assertThat(brown_fox.toString(), brown_fox.getTotalScore(), greaterThan(0.0D));}{ // now flip things: our analysisField filters stopwords,@@ -598,13 +594,13 @@ public class PhrasesIdentificationComponentTest extends SolrTestCaseJ4 {// "brown fox" should score positively in both fields, and overall...final Phrase brown_fox = phrases.get(phrases.size() - 2);assertEquals("brown fox", brown_fox.getSubSequence().toString());- MatcherAssert.assertThat(+ assertThat(brown_fox.toString(), brown_fox.getFieldScore("multigrams_title"), greaterThan(0.0D));- MatcherAssert.assertThat(+ assertThat(brown_fox.toString(),brown_fox.getFieldScore("multigrams_title_stop"),greaterThan(0.0D));- MatcherAssert.assertThat(brown_fox.toString(), brown_fox.getTotalScore(), greaterThan(0.0D));+ assertThat(brown_fox.toString(), brown_fox.getTotalScore(), greaterThan(0.0D));}}diff --git a/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.java b/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.javaindex 47bbff89233..0bf6140dad9 100644--- a/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.java+++ b/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.java@@ -35,7 +35,6 @@ import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.embedded.JettySolrRunner;import org.apache.solr.security.AllowListUrlChecker;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -131,19 +130,15 @@ public class ShardsAllowListTest extends MultiSolrCloudTestCase {@Testpublic void test() throws Exception {- MatcherAssert.assertThat(- getAllowListUrlChecker(EXPLICIT_CLUSTER_KEY).getHostAllowList(), notNullValue());- MatcherAssert.assertThat(- getAllowListUrlChecker(IMPLICIT_CLUSTER_KEY).getHostAllowList().isEmpty(), is(true));-- MatcherAssert.assertThat(- getAllowListUrlChecker(EXPLICIT_CLUSTER_KEY).hasExplicitAllowList(), is(true));- MatcherAssert.assertThat(- getAllowListUrlChecker(IMPLICIT_CLUSTER_KEY).hasExplicitAllowList(), is(false));+ assertThat(getAllowListUrlChecker(EXPLICIT_CLUSTER_KEY).getHostAllowList(), notNullValue());+ assertThat(getAllowListUrlChecker(IMPLICIT_CLUSTER_KEY).getHostAllowList().isEmpty(), is(true));++ assertThat(getAllowListUrlChecker(EXPLICIT_CLUSTER_KEY).hasExplicitAllowList(), is(true));+ assertThat(getAllowListUrlChecker(IMPLICIT_CLUSTER_KEY).hasExplicitAllowList(), is(false));for (MiniSolrCloudCluster cluster : clusterId2cluster.values()) {for (JettySolrRunner runner : cluster.getJettySolrRunners()) {URI uri = runner.getBaseUrl().toURI();- MatcherAssert.assertThat(+ assertThat(getAllowListUrlChecker(EXPLICIT_CLUSTER_KEY).getHostAllowList(),hasItem(uri.getHost() + ":" + uri.getPort()));}@@ -162,21 +157,21 @@ public class ShardsAllowListTest extends MultiSolrCloudTestCase {cluster.getSolrClient().commit(COLLECTION_NAME, true, true);// test using ClusterState elements- MatcherAssert.assertThat(+ assertThat("No shards specified, should work in both clusters",numDocs("*:*", null, cluster),is(10));- MatcherAssert.assertThat(+ assertThat("Both shards specified, should work in both clusters",numDocs("*:*", "shard1,shard2", cluster),is(10));- MatcherAssert.assertThat(+ assertThat("Both shards specified with collection name, should work in both clusters",numDocs("*:*", COLLECTION_NAME + "_shard1", cluster),is(numDocs("*:*", "shard1", cluster)));// test using explicit urls from within the cluster- MatcherAssert.assertThat(+ assertThat("Shards has the full URLs, should be allowed since they are internal. Cluster="+ entry.getKey(),numDocs(@@ -184,7 +179,7 @@ public class ShardsAllowListTest extends MultiSolrCloudTestCase {getShardUrl("shard1", cluster) + "," + getShardUrl("shard2", cluster),cluster),is(10));- MatcherAssert.assertThat(+ assertThat("Full URL without scheme",numDocs("*:*",@@ -195,11 +190,11 @@ public class ShardsAllowListTest extends MultiSolrCloudTestCase {is(10));// Mix shards with URLs- MatcherAssert.assertThat(+ assertThat("Mix URL and cluster state object",numDocs("*:*", "shard1," + getShardUrl("shard2", cluster), cluster),is(10));- MatcherAssert.assertThat(+ assertThat("Mix URL and cluster state object",numDocs("*:*", getShardUrl("shard1", cluster) + ",shard2", cluster),is(10));@@ -207,7 +202,7 @@ public class ShardsAllowListTest extends MultiSolrCloudTestCase {// explicit allow-list includes all the nodes in both clusters. Requests should be allowed to go// through- MatcherAssert.assertThat(+ assertThat("A request to the explicit cluster with shards that point to the implicit one",numDocs("id:implicitCluster*",@@ -215,7 +210,7 @@ public class ShardsAllowListTest extends MultiSolrCloudTestCase {explicitCluster),is(10));- MatcherAssert.assertThat(+ assertThat("A request to the explicit cluster with shards that point to the both clusters",numDocs("*:*",@@ -243,7 +238,7 @@ public class ShardsAllowListTest extends MultiSolrCloudTestCase {assertForbidden("id:explicitCluster*", getShardUrl("shard1", explicitCluster), implicitCluster);- MatcherAssert.assertThat(+ assertThat("A typical internal request, should be handled locally",numDocs("id:explicitCluster*",@@ -275,10 +270,9 @@ public class ShardsAllowListTest extends MultiSolrCloudTestCase {numDocs(query, shards, cluster);fail("Expecting failure for shards parameter: '" + shards + "'");} catch (SolrServerException e) {- MatcherAssert.assertThat(e.getCause(), instanceOf(SolrException.class));- MatcherAssert.assertThat(- ((SolrException) e.getCause()).code(), is(SolrException.ErrorCode.FORBIDDEN.code));- MatcherAssert.assertThat(e.getCause().getMessage(), containsString(expectedExceptionMessage));+ assertThat(e.getCause(), instanceOf(SolrException.class));+ assertThat(((SolrException) e.getCause()).code(), is(SolrException.ErrorCode.FORBIDDEN.code));+ assertThat(e.getCause().getMessage(), containsString(expectedExceptionMessage));} finally {unIgnoreException(expectedExceptionMessage);}diff --git a/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentContextFilterQueryTest.java b/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentContextFilterQueryTest.javaindex 378f0b7da13..3d02dc6c395 100644--- a/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentContextFilterQueryTest.java+++ b/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentContextFilterQueryTest.java@@ -20,7 +20,6 @@ import static org.hamcrest.core.Is.is;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.spelling.suggest.SuggesterParams;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Ignore;import org.junit.Test;@@ -161,7 +160,7 @@ public class SuggestComponentContextFilterQueryTest extends SolrTestCaseJ4 {SuggesterParams.SUGGEST_Q,"examp"));});- MatcherAssert.assertThat(ex.getMessage(), is("this suggester doesn't support contexts"));+ assertThat(ex.getMessage(), is("this suggester doesn't support contexts"));// When not building, no exception is thrownassertQ(diff --git a/solr/core/src/test/org/apache/solr/handler/component/TestHttpShardHandlerFactory.java b/solr/core/src/test/org/apache/solr/handler/component/TestHttpShardHandlerFactory.javaindex 5b162b33ef7..bf7a97e0ed8 100644--- a/solr/core/src/test/org/apache/solr/handler/component/TestHttpShardHandlerFactory.java+++ b/solr/core/src/test/org/apache/solr/handler/component/TestHttpShardHandlerFactory.java@@ -32,7 +32,6 @@ import org.apache.solr.client.solrj.impl.LBSolrClient;import org.apache.solr.client.solrj.request.QueryRequest;import org.apache.solr.common.cloud.ClusterState;import org.apache.solr.core.CoreContainer;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -134,7 +133,7 @@ public class TestHttpShardHandlerFactory extends SolrTestCaseJ4 {cc = CoreContainer.createAndLoad(home, home.resolve("solr.xml"));factory = cc.getShardHandlerFactory();assertTrue(factory instanceof HttpShardHandlerFactory);- MatcherAssert.assertThat(+ assertThat(cc.getAllowListUrlChecker().getHostAllowList(),equalTo(new HashSet<>(Arrays.asList("abc:8983", "def:8984"))));} finally {@@ -150,9 +149,9 @@ public class TestHttpShardHandlerFactory extends SolrTestCaseJ4 {new HashSet<>(Arrays.asList("1.2.3.4:8983_solr", "1.2.3.4:9000_", "1.2.3.4:9001_solr-2"));ClusterState cs = new ClusterState(liveNodes, new HashMap<>());Set<String> hostSet = cs.getHostAllowList();- MatcherAssert.assertThat(hostSet.size(), is(3));- MatcherAssert.assertThat(hostSet, hasItem("1.2.3.4:8983"));- MatcherAssert.assertThat(hostSet, hasItem("1.2.3.4:9000"));- MatcherAssert.assertThat(hostSet, hasItem("1.2.3.4:9001"));+ assertThat(hostSet.size(), is(3));+ assertThat(hostSet, hasItem("1.2.3.4:8983"));+ assertThat(hostSet, hasItem("1.2.3.4:9000"));+ assertThat(hostSet, hasItem("1.2.3.4:9001"));}}diff --git a/solr/core/src/test/org/apache/solr/response/transform/TestChildDocTransformer.java b/solr/core/src/test/org/apache/solr/response/transform/TestChildDocTransformer.javaindex d24e726ba9b..d72e5be0d14 100644--- a/solr/core/src/test/org/apache/solr/response/transform/TestChildDocTransformer.java+++ b/solr/core/src/test/org/apache/solr/response/transform/TestChildDocTransformer.java@@ -28,7 +28,6 @@ import org.apache.solr.common.SolrInputDocument;import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.response.BasicResultContext;import org.apache.solr.util.RandomNoReverseMergePolicyFactory;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.BeforeClass;import org.junit.ClassRule;@@ -144,7 +143,7 @@ public class TestChildDocTransformer extends SolrTestCaseJ4 {"id, subject,[child parentFilter=\"subject:bleh\" childFilter=\"title:bar\" limit=2]"));});assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(+ assertThat(e.getMessage(),containsString("Parent filter 'QueryBitSetProducer(subject:bleh)' doesn't match any parent documents"));@@ -163,7 +162,7 @@ public class TestChildDocTransformer extends SolrTestCaseJ4 {"id, subject,[child parentFilter=e childFilter=\"title:bar\" limit=2]"));});assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(+ assertThat(e.getMessage(),containsString("Parent filter 'QueryBitSetProducer(text:e)' doesn't match any parent documents"));@@ -182,8 +181,7 @@ public class TestChildDocTransformer extends SolrTestCaseJ4 {"id, subject,[child parentFilter=\"\"]"));});assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(- e.getMessage(), containsString("Invalid Parent filter '', resolves to null"));+ assertThat(e.getMessage(), containsString("Invalid Parent filter '', resolves to null"));}private void testSubQueryXML() {diff --git a/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java b/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.javaindex 98a65a3ebae..81b252e57d3 100644--- a/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java+++ b/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java@@ -47,7 +47,6 @@ import org.apache.solr.util.LogListener;import org.apache.solr.util.RESTfulServerProvider;import org.apache.solr.util.RestTestBase;import org.apache.solr.util.RestTestHarness;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.Before;import org.junit.Test;@@ -1288,10 +1287,8 @@ public class TestBulkSchemaAPI extends RestTestBase {"/responseHeader/status==0");assertEquals(2, listener.getCount());- MatcherAssert.assertThat(- listener.pollMessage(), containsString("hardcoded behavior is omitNorms=true"));- MatcherAssert.assertThat(- listener.pollMessage(), containsString("hardcoded behavior is termOffsets=false"));+ assertThat(listener.pollMessage(), containsString("hardcoded behavior is omitNorms=true"));+ assertThat(listener.pollMessage(), containsString("hardcoded behavior is termOffsets=false"));// Add a date range field with violated invariantsassertJPost(diff --git a/solr/core/src/test/org/apache/solr/schema/DenseVectorFieldTest.java b/solr/core/src/test/org/apache/solr/schema/DenseVectorFieldTest.javaindex 03b3fa0d750..4b753398521 100644--- a/solr/core/src/test/org/apache/solr/schema/DenseVectorFieldTest.java+++ b/solr/core/src/test/org/apache/solr/schema/DenseVectorFieldTest.java@@ -28,7 +28,6 @@ import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.core.AbstractBadConfigTestBase;import org.apache.solr.util.vector.DenseVectorParser;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.Test;@@ -94,9 +93,8 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {assertNotNull(vector);DenseVectorField type = (DenseVectorField) vector.getType();- MatcherAssert.assertThat(- type.getSimilarityFunction(), is(VectorSimilarityFunction.EUCLIDEAN));- MatcherAssert.assertThat(type.getDimension(), is(4));+ assertThat(type.getSimilarityFunction(), is(VectorSimilarityFunction.EUCLIDEAN));+ assertThat(type.getDimension(), is(4));assertTrue(vector.indexed());assertTrue(vector.stored());@@ -115,8 +113,8 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {assertNotNull(vector);DenseVectorField type = (DenseVectorField) vector.getType();- MatcherAssert.assertThat(type.getSimilarityFunction(), is(VectorSimilarityFunction.COSINE));- MatcherAssert.assertThat(type.getDimension(), is(4));+ assertThat(type.getSimilarityFunction(), is(VectorSimilarityFunction.COSINE));+ assertThat(type.getDimension(), is(4));assertTrue(vector.indexed());assertTrue(vector.stored());@@ -135,43 +133,42 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {assertNotNull(vector);DenseVectorField type1 = (DenseVectorField) vector.getType();- MatcherAssert.assertThat(type1.getSimilarityFunction(), is(VectorSimilarityFunction.COSINE));- MatcherAssert.assertThat(type1.getDimension(), is(4));- MatcherAssert.assertThat(type1.getKnnAlgorithm(), is("hnsw"));- MatcherAssert.assertThat(type1.getHnswMaxConn(), is(10));- MatcherAssert.assertThat(type1.getHnswBeamWidth(), is(40));+ assertThat(type1.getSimilarityFunction(), is(VectorSimilarityFunction.COSINE));+ assertThat(type1.getDimension(), is(4));+ assertThat(type1.getKnnAlgorithm(), is("hnsw"));+ assertThat(type1.getHnswMaxConn(), is(10));+ assertThat(type1.getHnswBeamWidth(), is(40));SchemaField vector2 = schema.getField("vector2");assertNotNull(vector2);DenseVectorField type2 = (DenseVectorField) vector2.getType();- MatcherAssert.assertThat(type2.getSimilarityFunction(), is(VectorSimilarityFunction.COSINE));- MatcherAssert.assertThat(type2.getDimension(), is(4));- MatcherAssert.assertThat(type2.getKnnAlgorithm(), is("hnsw"));- MatcherAssert.assertThat(type2.getHnswMaxConn(), is(6));- MatcherAssert.assertThat(type2.getHnswBeamWidth(), is(60));+ assertThat(type2.getSimilarityFunction(), is(VectorSimilarityFunction.COSINE));+ assertThat(type2.getDimension(), is(4));+ assertThat(type2.getKnnAlgorithm(), is("hnsw"));+ assertThat(type2.getHnswMaxConn(), is(6));+ assertThat(type2.getHnswBeamWidth(), is(60));SchemaField vector3 = schema.getField("vector3");assertNotNull(vector3);DenseVectorField type3 = (DenseVectorField) vector3.getType();- MatcherAssert.assertThat(type3.getSimilarityFunction(), is(VectorSimilarityFunction.COSINE));- MatcherAssert.assertThat(type3.getDimension(), is(5));+ assertThat(type3.getSimilarityFunction(), is(VectorSimilarityFunction.COSINE));+ assertThat(type3.getDimension(), is(5));- MatcherAssert.assertThat(type3.getKnnAlgorithm(), is("hnsw"));- MatcherAssert.assertThat(type3.getHnswMaxConn(), is(8));- MatcherAssert.assertThat(type3.getHnswBeamWidth(), is(46));+ assertThat(type3.getKnnAlgorithm(), is("hnsw"));+ assertThat(type3.getHnswMaxConn(), is(8));+ assertThat(type3.getHnswBeamWidth(), is(46));SchemaField vectorDefault = schema.getField("vector_default");assertNotNull(vectorDefault);DenseVectorField typeDefault = (DenseVectorField) vectorDefault.getType();- MatcherAssert.assertThat(- typeDefault.getSimilarityFunction(), is(VectorSimilarityFunction.COSINE));- MatcherAssert.assertThat(typeDefault.getKnnAlgorithm(), is("hnsw"));- MatcherAssert.assertThat(typeDefault.getDimension(), is(4));- MatcherAssert.assertThat(typeDefault.getHnswMaxConn(), is(16));- MatcherAssert.assertThat(typeDefault.getHnswBeamWidth(), is(100));+ assertThat(typeDefault.getSimilarityFunction(), is(VectorSimilarityFunction.COSINE));+ assertThat(typeDefault.getKnnAlgorithm(), is("hnsw"));+ assertThat(typeDefault.getDimension(), is(4));+ assertThat(typeDefault.getHnswMaxConn(), is(16));+ assertThat(typeDefault.getHnswBeamWidth(), is(100));} finally {deleteCore();}@@ -188,7 +185,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {.getVectorBuilder("string", DenseVectorParser.BuilderPhase.INDEX).getFloatVector();});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("incorrect vector format. The expected format is:'[f1,f2..f3]' where each element f is a float"));@@ -202,7 +199,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {.getVectorBuilder("string", DenseVectorParser.BuilderPhase.INDEX).getByteVector();});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("incorrect vector format. The expected format is:'[b1,b2..b3]' where each element b is a byte (-128 to 127)"));@@ -216,7 +213,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {.getVectorBuilder(1.5f, DenseVectorParser.BuilderPhase.INDEX).getFloatVector();});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("incorrect vector format. The expected format is:'[f1,f2..f3]' where each element f is a float"));@@ -230,7 +227,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {.getVectorBuilder("1", DenseVectorParser.BuilderPhase.INDEX).getByteVector();});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("incorrect vector format. The expected format is:'[b1,b2..b3]' where each element b is a byte (-128 to 127)"));@@ -252,7 +249,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {DenseVectorParser.BuilderPhase.INDEX).getFloatVector();});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("incorrect vector format. The expected format is:'[f1,f2..f3]' where each element f is a float"));@@ -271,7 +268,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {DenseVectorParser.BuilderPhase.INDEX).getByteVector();});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("incorrect vector format. The expected format is:'[b1,b2..b3]' where each element b is a byte (-128 to 127)"));@@ -290,7 +287,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {.getVectorBuilder(Arrays.asList(1.0f, 1.5f), DenseVectorParser.BuilderPhase.INDEX).getFloatVector();});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("incorrect vector dimension. The vector value has size 2 while it is expected a vector with size 3"));@@ -304,7 +301,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {.getVectorBuilder(Arrays.asList(2, 1), DenseVectorParser.BuilderPhase.INDEX).getByteVector();});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("incorrect vector dimension. The vector value has size 2 while it is expected a vector with size 3"));@@ -323,7 +320,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {DenseVectorParser.BuilderPhase.INDEX).getFloatVector();});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("incorrect vector element: 'string'. The expected format is:'[f1,f2..f3]' where each element f is a float"));@@ -338,7 +335,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {Arrays.asList("1", "string", "string2"), DenseVectorParser.BuilderPhase.INDEX).getByteVector();});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("incorrect vector element: 'string'. The expected format is:'[b1,b2..b3]' where each element b is a byte (-128 to 127)"));@@ -352,7 +349,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {@Testpublic void parseVector_StringArrayList_shouldParseFloatArray() {float[] expected = new float[] {1.1f, 2.2f, 3.3f};- MatcherAssert.assertThat(+ assertThat(toTestFloatEncoding.getVectorBuilder(Arrays.asList("1.1", "2.2", "3.3"), DenseVectorParser.BuilderPhase.INDEX)@@ -363,7 +360,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {@Testpublic void parseVector_StringArrayList_shouldParseByteArray() {byte[] expected = new byte[] {1, 2, 3};- MatcherAssert.assertThat(+ assertThat(toTestByteEncoding.getVectorBuilder(Arrays.asList("1", "2", "3"), DenseVectorParser.BuilderPhase.INDEX).getByteVector(),@@ -377,7 +374,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {@Testpublic void parseVector_DoubleArrayList_shouldParseFloatArray() {float[] expected = new float[] {1.7f, 5.4f, 6.6f};- MatcherAssert.assertThat(+ assertThat(toTestFloatEncoding.getVectorBuilder(Arrays.asList(1.7d, 5.4d, 6.6d), DenseVectorParser.BuilderPhase.INDEX).getFloatVector(),@@ -393,7 +390,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {toTestFloatEncoding = new DenseVectorField(3);float[] expected = new float[] {5.5f, 7.7f, 9.8f};- MatcherAssert.assertThat(+ assertThat(toTestFloatEncoding.getVectorBuilder(Arrays.asList(5.5f, 7.7f, 9.8f), DenseVectorParser.BuilderPhase.INDEX).getFloatVector(),@@ -403,7 +400,7 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {@Testpublic void parseVector_IntArrayList_shouldParseByteArray() {byte[] expected = new byte[] {5, 7, 9};- MatcherAssert.assertThat(+ assertThat(toTestByteEncoding.getVectorBuilder(Arrays.asList(5, 7, 9), DenseVectorParser.BuilderPhase.INDEX).getByteVector(),@@ -699,12 +696,12 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {assertU(adoc(doc));});- MatcherAssert.assertThat(+ assertThat(thrown.getCause().getMessage(),is("Error while creating field 'vector_byte_encoding{type=knn_vector_byte_encoding,properties=indexed,stored}' from value '[128, 6, 7, 8]'"));- MatcherAssert.assertThat(+ assertThat(thrown.getCause().getCause().getMessage(),is("incorrect vector element: '128'. The expected format is:'[b1,b2..b3]' where each element b is a byte (-128 to 127)"));@@ -721,11 +718,11 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {assertU(adoc(doc1));});- MatcherAssert.assertThat(+ assertThat(thrown.getCause().getMessage(),is("Error while creating field 'vector_byte_encoding{type=knn_vector_byte_encoding,properties=indexed,stored}' from value '[1, -129, 7, 8]'"));- MatcherAssert.assertThat(+ assertThat(thrown.getCause().getCause().getMessage(),is("incorrect vector element: '-129'. The expected format is:'[b1,b2..b3]' where each element b is a byte (-128 to 127)"));@@ -750,12 +747,12 @@ public class DenseVectorFieldTest extends AbstractBadConfigTestBase {assertU(adoc(doc));});- MatcherAssert.assertThat(+ assertThat(thrown.getCause().getMessage(),is("Error while creating field 'vector_byte_encoding{type=knn_vector_byte_encoding,properties=indexed,stored}' from value '[14.3, 6.2, 7.2, 8.1]'"));- MatcherAssert.assertThat(+ assertThat(thrown.getCause().getCause().getMessage(),is("incorrect vector element: '14.3'. The expected format is:'[b1,b2..b3]' where each element b is a byte (-128 to 127)"));diff --git a/solr/core/src/test/org/apache/solr/schema/TestSortableTextField.java b/solr/core/src/test/org/apache/solr/schema/TestSortableTextField.javaindex 2864ced67d9..de2c5c64bea 100644--- a/solr/core/src/test/org/apache/solr/schema/TestSortableTextField.java+++ b/solr/core/src/test/org/apache/solr/schema/TestSortableTextField.java@@ -38,7 +38,6 @@ import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrException.ErrorCode;import org.apache.solr.search.SolrIndexSearcher;import org.apache.solr.util.RefCounted;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.BeforeClass;@@ -291,23 +290,23 @@ public class TestSortableTextField extends SolrTestCaseJ4 {"whitespace_l_stxt")) {values = createIndexableFields(field);assertEquals(field, 2, values.size());- MatcherAssert.assertThat(field, values.get(0), instanceOf(Field.class));- MatcherAssert.assertThat(field, values.get(1), instanceOf(SortedDocValuesField.class));+ assertThat(field, values.get(0), instanceOf(Field.class));+ assertThat(field, values.get(1), instanceOf(SortedDocValuesField.class));}// special cases...values = createIndexableFields("whitespace_nois_stxt");assertEquals(1, values.size());- MatcherAssert.assertThat(values.get(0), instanceOf(SortedDocValuesField.class));+ assertThat(values.get(0), instanceOf(SortedDocValuesField.class));//values = createIndexableFields("whitespace_nodv_stxt");assertEquals(1, values.size());- MatcherAssert.assertThat(values.get(0), instanceOf(Field.class));+ assertThat(values.get(0), instanceOf(Field.class));//values = createIndexableFields("whitespace_m_stxt");assertEquals(2, values.size());- MatcherAssert.assertThat(values.get(0), instanceOf(Field.class));- MatcherAssert.assertThat(values.get(1), instanceOf(SortedSetDocValuesField.class));+ assertThat(values.get(0), instanceOf(Field.class));+ assertThat(values.get(1), instanceOf(SortedSetDocValuesField.class));}private List<IndexableField> createIndexableFields(String fieldName) {diff --git a/solr/core/src/test/org/apache/solr/search/CursorMarkTest.java b/solr/core/src/test/org/apache/solr/search/CursorMarkTest.javaindex b9ab7842a1d..e1dd1079584 100644--- a/solr/core/src/test/org/apache/solr/search/CursorMarkTest.java+++ b/solr/core/src/test/org/apache/solr/search/CursorMarkTest.java@@ -38,7 +38,6 @@ import org.apache.solr.common.SolrException.ErrorCode;import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.schema.IndexSchema;import org.apache.solr.schema.SchemaField;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;/**@@ -86,7 +85,7 @@ public class CursorMarkTest extends SolrTestCaseJ4 {previous.createNext(Arrays.<Object>asList(buildRandomSortObjects(otherSort)));});assertEquals(500, e.code());- MatcherAssert.assertThat(e.getMessage(), containsString("sort values != sort length"));+ assertThat(e.getMessage(), containsString("sort values != sort length"));}public void testInvalidUsage() {diff --git a/solr/core/src/test/org/apache/solr/search/RankQParserPluginTest.java b/solr/core/src/test/org/apache/solr/search/RankQParserPluginTest.javaindex 3532cd5a15a..edada27727a 100644--- a/solr/core/src/test/org/apache/solr/search/RankQParserPluginTest.java+++ b/solr/core/src/test/org/apache/solr/search/RankQParserPluginTest.java@@ -33,7 +33,6 @@ import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.schema.RankField;import org.apache.solr.search.RankQParserPlugin.RankQParser;import org.hamcrest.CoreMatchers;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;public class RankQParserPluginTest extends SolrTestCaseJ4 {@@ -313,7 +312,7 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {QParser parser = getRankQParser(localParams, req());Query q = parser.parse();assertNotNull(q);- MatcherAssert.assertThat(q.toString(), CoreMatchers.equalTo(expectedToString));+ assertThat(q.toString(), CoreMatchers.equalTo(expectedToString));}private String expectedFeatureQueryToString(String fieldName, String function, float boost) {@@ -346,7 +345,7 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {private void assertSyntaxError(String assertionMsg, String expectedExceptionMsg, ThrowingRunnable runnable) {SyntaxError se = expectThrows(SyntaxError.class, assertionMsg, runnable);- MatcherAssert.assertThat(se.getMessage(), CoreMatchers.containsString(expectedExceptionMsg));+ assertThat(se.getMessage(), CoreMatchers.containsString(expectedExceptionMsg));}private RankQParser getRankQParser(SolrParams localParams, SolrQueryRequest req)diff --git a/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.java b/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.javaindex a8b651f66b7..c6175d24dd7 100644--- a/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.java+++ b/solr/core/src/test/org/apache/solr/search/TestBlockCollapse.java@@ -31,7 +31,6 @@ import org.apache.solr.common.params.SolrParams;import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.request.SolrRequestInfo;import org.apache.solr.response.SolrQueryResponse;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.BeforeClass;@@ -75,19 +74,19 @@ public class TestBlockCollapse extends SolrTestCaseJ4 {" nullPolicy=collapse",// when policy is 'collapse' hint should be ignored..." nullPolicy=collapse hint=block")) {- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=foo_s1" + np + "}", req),instanceOf(CollapsingQParserPlugin.OrdScoreCollector.class));- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=foo_i" + np + "}", req),instanceOf(CollapsingQParserPlugin.IntScoreCollector.class));for (String selector : fieldValueSelectors) {- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=foo_s1 " + selector + np + "}", req),instanceOf(CollapsingQParserPlugin.OrdFieldValueCollector.class));}for (String selector : fieldValueSelectors) {- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=foo_i " + selector + np + "}", req),instanceOf(CollapsingQParserPlugin.IntFieldValueCollector.class));}@@ -95,15 +94,15 @@ public class TestBlockCollapse extends SolrTestCaseJ4 {// anything with cscore() is (currently) off limits regardless of null policy or hint...for (String selector : Arrays.asList(" min=sum(42,cscore())", " max=cscore()")) {for (String hint : Arrays.asList("", " hint=block")) {- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=_root_" + selector + np + hint + "}", req),instanceOf(CollapsingQParserPlugin.OrdFieldValueCollector.class));- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=foo_s1" + selector + np + hint + "}", req),instanceOf(CollapsingQParserPlugin.OrdFieldValueCollector.class));- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=foo_i" + selector + np + hint + "}", req),instanceOf(CollapsingQParserPlugin.IntFieldValueCollector.class));@@ -113,29 +112,29 @@ public class TestBlockCollapse extends SolrTestCaseJ4 {// block based collectors as long as nullPolicy isn't collapse...for (String np : Arrays.asList("", " nullPolicy=ignore", " nullPolicy=expand")) {- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=_root_" + np + "}", req), // implicit block collection on _root_instanceOf(CollapsingQParserPlugin.BlockOrdScoreCollector.class));- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=_root_ hint=top_fc" + np + "}",req), // top_fc shouldn't stop implicit block collectioninstanceOf(CollapsingQParserPlugin.BlockOrdScoreCollector.class));- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=foo_s1 hint=block" + np + "}", req),instanceOf(CollapsingQParserPlugin.BlockOrdScoreCollector.class));- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=foo_i hint=block" + np + "}", req),instanceOf(CollapsingQParserPlugin.BlockIntScoreCollector.class));for (String selector : fieldValueSelectors) {- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=foo_s1 hint=block " + selector + np + "}", req),instanceOf(CollapsingQParserPlugin.BlockOrdSortSpecCollector.class));}for (String selector : fieldValueSelectors) {- MatcherAssert.assertThat(+ assertThat(parseAndBuildCollector("{!collapse field=foo_i hint=block " + selector + np + "}", req),instanceOf(CollapsingQParserPlugin.BlockIntSortSpecCollector.class));diff --git a/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.javaindex c28db60dfd9..962186fd8b2 100644--- a/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.java+++ b/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.java@@ -34,7 +34,6 @@ import org.apache.solr.common.params.ModifiableSolrParams;import org.apache.solr.common.params.SolrParams;import org.apache.solr.search.CollapsingQParserPlugin.GroupHeadSelector;import org.apache.solr.search.CollapsingQParserPlugin.GroupHeadSelectorType;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.BeforeClass;import org.junit.Test;@@ -975,8 +974,7 @@ public class TestCollapseQParserPlugin extends SolrTestCaseJ4 {"id")));});assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, ex.code());- MatcherAssert.assertThat(- ex.getMessage(), containsString("Can not use collapse with Grouping enabled"));+ assertThat(ex.getMessage(), containsString("Can not use collapse with Grouping enabled"));// delete the elevated docs, confirm collapsing still worksassertU(delI("1"));diff --git a/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java b/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.javaindex be3edd51934..df78f80215e 100644--- a/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java+++ b/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java@@ -51,7 +51,6 @@ import org.apache.solr.common.util.Utils;import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.util.BaseTestHarness;import org.apache.solr.util.SolrPluginUtils;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;@@ -1385,19 +1384,19 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {"edismax","debugQuery","true"));- MatcherAssert.assertThat(+ assertThat("phrase field queries spanning multiple fields should be within their own dismax queries",parsedquery,anyOf(containsString("(phrase_sw:\"aaaa bbbb\" | phrase1_sw:\"aaaa bbbb\")"),containsString("(phrase1_sw:\"aaaa bbbb\" | phrase_sw:\"aaaa bbbb\")")));- MatcherAssert.assertThat(+ assertThat("phrase field queries spanning multiple fields should be within their own dismax queries",parsedquery,anyOf(containsString("(phrase_sw:\"bbbb cccc\" | phrase1_sw:\"bbbb cccc\")"),containsString("(phrase1_sw:\"bbbb cccc\" | phrase_sw:\"bbbb cccc\")")));- MatcherAssert.assertThat(+ assertThat("phrase field queries spanning multiple fields should be within their own dismax queries",parsedquery,anyOf(@@ -2301,20 +2300,20 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {"false","debugQuery","true"));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:barking | title:barking))"),containsString("((title:barking | name:barking))")));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:curds | title:curds))"),containsString("((title:curds | name:curds))")));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:of | title:of))"), containsString("((title:of | name:of))")));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:stigma | title:stigma))"),@@ -2332,20 +2331,20 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {"true","debugQuery","true"));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:barking | title:barking))"),containsString("((title:barking | name:barking))")));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:curds | title:curds))"),containsString("((title:curds | name:curds))")));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:of | title:of))"), containsString("((title:of | name:of))")));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:stigma | title:stigma))"),@@ -2361,20 +2360,20 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {"edismax","debugQuery","true")); // Default sow=false- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:barking | title:barking))"),containsString("((title:barking | name:barking))")));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:curds | title:curds))"),containsString("((title:curds | name:curds))")));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:of | title:of))"), containsString("((title:of | name:of))")));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((name:stigma | title:stigma))"),@@ -2499,13 +2498,13 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {"true","debugQuery","true"));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((text_sw:oliv | title:olive))"),containsString("((title:olive | text_sw:oliv))")));- MatcherAssert.assertThat(parsedquery, containsString("DisjunctionMaxQuery((title:the))"));- MatcherAssert.assertThat(+ assertThat(parsedquery, containsString("DisjunctionMaxQuery((title:the))"));+ assertThat(parsedquery,anyOf(containsString("((text_sw:other | title:other))"),@@ -2524,7 +2523,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {"false","debugQuery","true"));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString(@@ -2551,18 +2550,18 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {"100%","debugQuery","true"));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((text_sw:oliv | title:olive))"),containsString("((title:olive | text_sw:oliv))")));- MatcherAssert.assertThat(parsedquery, containsString("DisjunctionMaxQuery((title:the))"));- MatcherAssert.assertThat(+ assertThat(parsedquery, containsString("DisjunctionMaxQuery((title:the))"));+ assertThat(parsedquery,anyOf(containsString("((text_sw:other | title:other))"),containsString("((title:other | text_sw:other))")));- MatcherAssert.assertThat(parsedquery, containsString("))~3"));+ assertThat(parsedquery, containsString("))~3"));parsedquery =getParsedQuery(@@ -2579,7 +2578,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {"100%","debugQuery","true"));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString(@@ -2603,17 +2602,17 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {sow,"debugQuery","true"));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((text_sw:oliv | title:olive))"),containsString("((title:olive | text_sw:oliv))")));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((text_sw:blah | title:blah))"),containsString("((title:blah | text_sw:blah))")));- MatcherAssert.assertThat(+ assertThat(parsedquery,anyOf(containsString("((text_sw:other | title:other))"),@@ -3026,7 +3025,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {try (SolrQueryRequest req = req(params)) {QParser qParser = QParser.getParser("grackle", "edismax", req);Query q = qParser.getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(@@ -3036,7 +3035,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {qParser = QParser.getParser("grackle wi fi", "edismax", req);q = qParser.getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(@@ -3050,7 +3049,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {try (SolrQueryRequest req = req(sowTrueParams)) {QParser qParser = QParser.getParser("grackle", "edismax", req);Query q = qParser.getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(@@ -3060,7 +3059,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {qParser = QParser.getParser("grackle wi fi", "edismax", req);q = qParser.getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(booleanQuery(@@ -3078,7 +3077,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {try (SolrQueryRequest req = req("sow", "false", "qf", "subject title")) {QParser qParser = QParser.getParser("one two", "edismax", req);Query q = qParser.getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(booleanQuery(@@ -3089,7 +3088,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {try (SolrQueryRequest req = req("sow", "false", "qf", "subject title^5")) {QParser qParser = QParser.getParser("one two", "edismax", req);Query q = qParser.getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(booleanQuery(@@ -3100,7 +3099,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {try (SolrQueryRequest req = req("sow", "false", "qf", "subject^3 title")) {QParser qParser = QParser.getParser("one two", "edismax", req);Query q = qParser.getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(booleanQuery(@@ -3111,7 +3110,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {try (SolrQueryRequest req = req("sow", "false", "qf", "subject^10 title^20")) {QParser qParser = QParser.getParser("one two", "edismax", req);Query q = qParser.getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(booleanQuery(@@ -3344,7 +3343,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {// test valid field namesString response = h.query(req(params));- MatcherAssert.assertThat(+ assertThat(response,allOf(containsString("+(+DisjunctionMaxQuery(("),diff --git a/solr/core/src/test/org/apache/solr/search/TestMaxScoreQueryParser.java b/solr/core/src/test/org/apache/solr/search/TestMaxScoreQueryParser.javaindex 6a625fba59e..1fca65a53bf 100644--- a/solr/core/src/test/org/apache/solr/search/TestMaxScoreQueryParser.java+++ b/solr/core/src/test/org/apache/solr/search/TestMaxScoreQueryParser.java@@ -36,7 +36,6 @@ import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.params.MapSolrParams;import org.apache.solr.common.params.ModifiableSolrParams;import org.apache.solr.legacy.LegacyNumericRangeQuery;-import org.hamcrest.MatcherAssert;import org.hamcrest.Matchers;import org.junit.BeforeClass;import org.junit.Test;@@ -66,7 +65,7 @@ public class TestMaxScoreQueryParser extends SolrTestCaseJ4 {expected = IndexOrDocValuesQuery.class;}}- MatcherAssert.assertThat(q, Matchers.instanceOf(expected));+ assertThat(q, Matchers.instanceOf(expected));}@Test@@ -96,7 +95,7 @@ public class TestMaxScoreQueryParser extends SolrTestCaseJ4 {assertEquals(2, qa.size());final Collection<String> qaStrings =qa.stream().map(q -> q.toString()).collect(Collectors.toList());- MatcherAssert.assertThat(qaStrings, hasItem("text:foo"));+ assertThat(qaStrings, hasItem("text:foo"));}@Testdiff --git a/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.javaindex 7701f05d4fc..09f3b7008e9 100644--- a/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.java+++ b/solr/core/src/test/org/apache/solr/search/TestRandomCollapseQParserPlugin.java@@ -32,7 +32,6 @@ import org.apache.solr.common.SolrDocument;import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.common.params.SolrParams;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -292,7 +291,7 @@ public class TestRandomCollapseQParserPlugin extends SolrTestCaseJ4 {SolrException e = expectThrows(SolrException.class, () -> SOLR.query(solrParams));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(e.getMessage(), containsString("Invalid nullPolicy: " + nullPolicy));+ assertThat(e.getMessage(), containsString("Invalid nullPolicy: " + nullPolicy));// valid nullPolicyassertQ(req("q", "*:*", "fq", "{!collapse field=id nullPolicy=" + randomNullPolicy() + "}"));diff --git a/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java b/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.javaindex 56b6566f37d..d38207e38ba 100644--- a/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java+++ b/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java@@ -58,7 +58,6 @@ import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.schema.IndexSchema;import org.apache.solr.schema.NumberType;import org.apache.solr.schema.SchemaField;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -489,7 +488,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {SolrException.class,"expected SolrException",() -> assertJQ(req("q", too_long), "/response/numFound==6"));- MatcherAssert.assertThat(e.getMessage(), containsString(expectedMsg));+ assertThat(e.getMessage(), containsString(expectedMsg));// but should still work as a filter query since TermsQuery can be used...assertJQ(req("q", "*:*", "fq", too_long), "/response/numFound==6");@@ -520,7 +519,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {SolrException.class,"expected SolrException",() -> assertJQ(req("q", way_too_long), "/response/numFound==6"));- MatcherAssert.assertThat(e.getMessage(), containsString(expectedMsg));+ assertThat(e.getMessage(), containsString(expectedMsg));assertNotNull(e.getCause());assertEquals(SyntaxError.class, e.getCause().getClass());@@ -1186,7 +1185,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {public void testSynonymQueryStyle() throws Exception {String field = "t_pick_best_foo";Query q = QParser.getParser("tabby", req(params("df", field))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,disjunctionOf(termQuery(field, "cat"),@@ -1196,7 +1195,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {field = "t_as_distinct_foo";q = QParser.getParser("tabby", req(params("df", field))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(termQuery(field, "cat"),@@ -1212,7 +1211,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {field = "t_pick_best_foo";q = QParser.getParser("jeans", req(params("df", field, "sow", "false"))).getQuery();- MatcherAssert.assertThat(+ assertThat(q, booleanQuery(disjunctionOf(termQuery(field, "jean"), phraseQuery(field, "denim pant"))));}@@ -1221,8 +1220,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {// tiger, tigre|0.9String field = "t_pick_best_boosted_foo";Query q = QParser.getParser("tiger", req(params("df", field))).getQuery();- MatcherAssert.assertThat(- q, disjunctionOf(termQuery(field, "tiger"), boosted(field, "tigre", 0.9f)));+ assertThat(q, disjunctionOf(termQuery(field, "tiger"), boosted(field, "tigre", 0.9f)));field = "t_as_distinct_boosted_foo";q = QParser.getParser("tiger", req(params("df", "t_as_distinct_boosted_foo"))).getQuery();@@ -1238,12 +1236,12 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {// lynx => lince|0.8, lynx_canadensis|0.9field = "t_pick_best_boosted_foo";q = QParser.getParser("lynx", req(params("df", field))).getQuery();- MatcherAssert.assertThat(+ assertThat(q, disjunctionOf(boosted(field, "lince", 0.8f), boosted(field, "lynx_canadensis", 0.9f)));field = "t_as_distinct_boosted_foo";q = QParser.getParser("lynx", req(params("df", field))).getQuery();- MatcherAssert.assertThat(+ assertThat(q, booleanQuery(boosted(field, "lince", 0.8f), boosted(field, "lynx_canadensis", 0.9f)));field = "t_as_same_term_boosted_foo";@@ -1258,7 +1256,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {// leopard, big cat|0.8, bagheera|0.9, panthera pardus|0.85String field = "t_pick_best_boosted_foo";Query q = QParser.getParser("leopard", req(params("df", "t_pick_best_boosted_foo"))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(@@ -1279,7 +1277,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {// lion => panthera leo|0.9, simba leo|0.8, kimba|0.75q = QParser.getParser("lion", req(params("df", "t_pick_best_boosted_foo"))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(@@ -1304,7 +1302,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {// lynx => lince|0.8, lynx_canadensis|0.9String field = "t_pick_best_boosted_foo";Query q = QParser.getParser("tiger lynx", req(params("df", field))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(boosted(field, "lince", 0.8f), boosted(field, "lynx_canadensis", 0.9f)),@@ -1329,7 +1327,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {// lion => panthera leo|0.9, simba leo|0.8, kimba|0.75String field = "t_pick_best_boosted_foo";Query q = QParser.getParser("leopard lion", req(params("df", field))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(@@ -1366,7 +1364,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {Query q =QParser.getParser("panthera pardus story", req(params("df", field, "sow", "false"))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(termQuery(field, "story"),@@ -1423,7 +1421,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {String field = "t_pick_best_boosted_foo";Query q =QParser.getParser("panthera blytheae", req(params("df", field, "sow", "false"))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(@@ -1454,7 +1452,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {String field = "t_pick_best_boosted_foo";Query q =QParser.getParser("snow leopard", req(params("df", field, "sow", "false"))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf( // TODO why does this generate a single clause Boolean?@@ -1484,7 +1482,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {QParser.getParser("panthera onca", req(params("df", "t_pick_best_boosted_foo", "sow", "false"))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(@@ -1517,7 +1515,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {Query q =QParser.getParser("panthera pardus tiger", req(params("df", field, "sow", "false"))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(boosted(field, "leopard", 0.6f), phraseQuery(field, "panthera pardus")),@@ -1550,7 +1548,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {Query q =QParser.getParser("snow leopard panthera onca", req(params("df", field, "sow", "false"))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(@@ -1593,7 +1591,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {true,req(params("sow", "false", "qf", field + "^10"))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(booleanQuery(@@ -1683,7 +1681,7 @@ public class TestSolrQueryParser extends SolrTestCaseJ4 {// leopard, big cat|0.8, bagheera|0.9, panthera pardus|0.85String field = "t_pick_best_boosted_foo";Query q = QParser.getParser("leopard", req(params("df", field))).getQuery();- MatcherAssert.assertThat(+ assertThat(q,booleanQuery(disjunctionOf(diff --git a/solr/core/src/test/org/apache/solr/search/TestTaskManagement.java b/solr/core/src/test/org/apache/solr/search/TestTaskManagement.javaindex fc5963b04e6..49fc8017317 100644--- a/solr/core/src/test/org/apache/solr/search/TestTaskManagement.java+++ b/solr/core/src/test/org/apache/solr/search/TestTaskManagement.java@@ -41,7 +41,6 @@ import org.apache.solr.common.params.ModifiableSolrParams;import org.apache.solr.common.util.ExecutorUtil;import org.apache.solr.common.util.NamedList;import org.hamcrest.Matcher;-import org.hamcrest.MatcherAssert;import org.hamcrest.Matchers;import org.junit.After;import org.junit.Before;@@ -170,9 +169,9 @@ public class TestTaskManagement extends SolrCloudTestCase {presentQueryIDs.add(Integer.parseInt(entry.getKey()));}- MatcherAssert.assertThat(presentQueryIDs.size(), betweenInclusive(0, 50));+ assertThat(presentQueryIDs.size(), betweenInclusive(0, 50));for (int value : presentQueryIDs) {- MatcherAssert.assertThat(value, betweenInclusive(0, 49));+ assertThat(value, betweenInclusive(0, 49));}}diff --git a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetErrors.java b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetErrors.javaindex d7a75ee4940..ea83c64ac21 100644--- a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetErrors.java+++ b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetErrors.java@@ -23,7 +23,6 @@ import org.apache.solr.JSONTestUtil;import org.apache.solr.SolrTestCaseHS;import org.apache.solr.common.SolrException;import org.apache.solr.common.params.SolrParams;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -588,7 +587,7 @@ public class TestJsonFacetErrors extends SolrTestCaseHS {h.query(req("q", "*:*", "json.facet", "{bleh:'div(2,4)'}"));});assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(+ assertThat(e.getMessage(),containsString("Expected multi-doc aggregation from 'div' but got per-doc function in input ('div(2,4)"));@@ -600,7 +599,7 @@ public class TestJsonFacetErrors extends SolrTestCaseHS {h.query(req("q", "*:*", "json.facet", "{b:'agg(div(2,4))'}"));});assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(+ assertThat(e.getMessage(),containsString("Expected multi-doc aggregation from 'div' but got per-doc function in input ('agg(div(2,4))"));@@ -612,7 +611,7 @@ public class TestJsonFacetErrors extends SolrTestCaseHS {h.query(req("q", "*:*", "json.facet", "{b:'agg(bleh(2,4))'}"));});assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(+ assertThat(e.getMessage(), containsString("Unknown aggregation 'bleh' in input ('agg(bleh(2,4))"));e =@@ -622,8 +621,7 @@ public class TestJsonFacetErrors extends SolrTestCaseHS {h.query(req("q", "*:*", "json.facet", "{b:'bleh(2,4)'}"));});assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(- e.getMessage(), containsString("Unknown aggregation 'bleh' in input ('bleh(2,4)"));+ assertThat(e.getMessage(), containsString("Unknown aggregation 'bleh' in input ('bleh(2,4)"));resetExceptionIgnores();}diff --git a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetsStatsParsing.java b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetsStatsParsing.javaindex ae356065748..4fdb05dff68 100644--- a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetsStatsParsing.java+++ b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetsStatsParsing.java@@ -26,7 +26,6 @@ import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.util.Utils;import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.search.function.FieldNameValueSource;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.noggit.ObjectBuilder;@@ -49,10 +48,10 @@ public class TestJsonFacetsStatsParsing extends SolrTestCaseJ4 {new FacetRequest.FacetSort("foo", FacetRequest.SortDirection.asc),new FacetRequest.FacetSort("foo", FacetRequest.SortDirection.asc));// negative assertions...- MatcherAssert.assertThat(+ assertThat(new FacetRequest.FacetSort("foo", FacetRequest.SortDirection.desc),not(new FacetRequest.FacetSort("foo", FacetRequest.SortDirection.asc)));- MatcherAssert.assertThat(+ assertThat(new FacetRequest.FacetSort("bar", FacetRequest.SortDirection.desc),not(new FacetRequest.FacetSort("foo", FacetRequest.SortDirection.desc)));}@@ -95,16 +94,15 @@ public class TestJsonFacetsStatsParsing extends SolrTestCaseJ4 {final AggValueSource agg = entry.getValue();assertEquals("name of " + key, "min", agg.name());- MatcherAssert.assertThat("type of " + key, agg, instanceOf(SimpleAggValueSource.class));+ assertThat("type of " + key, agg, instanceOf(SimpleAggValueSource.class));SimpleAggValueSource sagg = (SimpleAggValueSource) agg;if (key.startsWith("f")) { // value source as arg to min- MatcherAssert.assertThat("vs of " + key, sagg.getArg(), instanceOf(IntFieldSource.class));+ assertThat("vs of " + key, sagg.getArg(), instanceOf(IntFieldSource.class));assertEquals("field of " + key, "foo_i", ((IntFieldSource) sagg.getArg()).getField());assertEquals(key + ".equals(f1)", agg, stats.get("f1"));} else if (key.startsWith("s")) { // field as arg to min- MatcherAssert.assertThat(- "vs of " + key, sagg.getArg(), instanceOf(FieldNameValueSource.class));+ assertThat("vs of " + key, sagg.getArg(), instanceOf(FieldNameValueSource.class));assertEquals("field of " + key, "foo_i", ((FieldNameValueSource) sagg.getArg()).getFieldName());assertEquals(key + ".equals(s1)", agg, stats.get("s1"));@@ -134,7 +132,7 @@ public class TestJsonFacetsStatsParsing extends SolrTestCaseJ4 {assertEquals(1, stats.size());AggValueSource agg = stats.get("x");assertNotNull(agg);- MatcherAssert.assertThat(agg, instanceOf(DebugAgg.class));+ assertThat(agg, instanceOf(DebugAgg.class));DebugAgg x = (DebugAgg) agg;assertEquals(new String[] {"abc", "xyz"}, x.localParams.getParams("foo"));diff --git a/solr/core/src/test/org/apache/solr/search/json/TestJsonRequest.java b/solr/core/src/test/org/apache/solr/search/json/TestJsonRequest.javaindex 2f553ff4476..f8527583aae 100644--- a/solr/core/src/test/org/apache/solr/search/json/TestJsonRequest.java+++ b/solr/core/src/test/org/apache/solr/search/json/TestJsonRequest.java@@ -30,7 +30,6 @@ import org.apache.solr.common.params.ModifiableSolrParams;import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.search.CaffeineCache;import org.apache.solr.search.DocSet;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -103,8 +102,7 @@ public class TestJsonRequest extends SolrTestCaseHS {SolrException ex =expectThrows(SolrException.class, () -> client.testJQ(params("q", "*:*", "json", "5")));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, ex.code());- MatcherAssert.assertThat(- ex.getMessage(), containsString("Expected JSON Object but got Long=5"));+ assertThat(ex.getMessage(), containsString("Expected JSON Object but got Long=5"));// this is to verify other json params are not affectedclient.testJQ(params("q", "cat_s:A", "json.limit", "1"), "response/numFound==2");@@ -579,7 +577,7 @@ public class TestJsonRequest extends SolrTestCaseHS {() -> {client.testJQ(params("json", "{query:{'lucene':'foo_s:ignore_exception'}}"));});- MatcherAssert.assertThat(e.getMessage(), containsString("foo_s"));+ assertThat(e.getMessage(), containsString("foo_s"));// test failure on unknown parametere =@@ -590,7 +588,7 @@ public class TestJsonRequest extends SolrTestCaseHS {params("json", "{query:'cat_s:A', foobar_ignore_exception:5}"),"response/numFound==2");});- MatcherAssert.assertThat(e.getMessage(), containsString("foobar"));+ assertThat(e.getMessage(), containsString("foobar"));resetExceptionIgnores();}diff --git a/solr/core/src/test/org/apache/solr/security/AllowListUrlCheckerTest.java b/solr/core/src/test/org/apache/solr/security/AllowListUrlCheckerTest.javaindex 56da97d24a1..b32c2124c15 100644--- a/solr/core/src/test/org/apache/solr/security/AllowListUrlCheckerTest.java+++ b/solr/core/src/test/org/apache/solr/security/AllowListUrlCheckerTest.java@@ -29,7 +29,6 @@ import java.util.List;import java.util.Set;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.SolrException;-import org.hamcrest.MatcherAssert;import org.junit.Test;/** Tests {@link AllowListUrlChecker}. */@@ -41,14 +40,14 @@ public class AllowListUrlCheckerTest extends SolrTestCaseJ4 {SolrException e =expectThrows(SolrException.class, () -> checker.checkAllowList(urls("abc-1.com:8983/solr")));- MatcherAssert.assertThat(e.code(), is(SolrException.ErrorCode.FORBIDDEN.code));+ assertThat(e.code(), is(SolrException.ErrorCode.FORBIDDEN.code));AllowListUrlChecker.ALLOW_ALL.checkAllowList(urls("abc-1.com:8983/solr"));}@Testpublic void testNoInput() throws Exception {- MatcherAssert.assertThat(+ assertThat(new AllowListUrlChecker(Collections.emptyList()).getHostAllowList().isEmpty(), is(true));}@@ -86,8 +85,8 @@ public class AllowListUrlCheckerTest extends SolrTestCaseJ4 {SolrException e =expectThrows(SolrException.class, () -> checker.checkAllowList(urls("http://abc-4.com:8983/solr")));- MatcherAssert.assertThat(e.code(), is(SolrException.ErrorCode.FORBIDDEN.code));- MatcherAssert.assertThat(e.getMessage(), containsString("http://abc-4.com:8983/solr"));+ assertThat(e.code(), is(SolrException.ErrorCode.FORBIDDEN.code));+ assertThat(e.getMessage(), containsString("http://abc-4.com:8983/solr"));}@Test@@ -99,8 +98,8 @@ public class AllowListUrlCheckerTest extends SolrTestCaseJ4 {expectThrows(SolrException.class,() -> checker.checkAllowList(urls("abc-1.com:8983/solr", "abc-4.com:8983/solr")));- MatcherAssert.assertThat(e.code(), is(SolrException.ErrorCode.FORBIDDEN.code));- MatcherAssert.assertThat(e.getMessage(), containsString("abc-4.com:8983/solr"));+ assertThat(e.code(), is(SolrException.ErrorCode.FORBIDDEN.code));+ assertThat(e.getMessage(), containsString("abc-4.com:8983/solr"));}@Test@@ -118,7 +117,7 @@ public class AllowListUrlCheckerTest extends SolrTestCaseJ4 {expectThrows(MalformedURLException.class,() -> new AllowListUrlChecker(urls("http/abc-1.com:8983")));- MatcherAssert.assertThat(e.getMessage(), containsString("http/abc-1.com:8983"));+ assertThat(e.getMessage(), containsString("http/abc-1.com:8983"));}@Test@@ -130,7 +129,7 @@ public class AllowListUrlCheckerTest extends SolrTestCaseJ4 {expectThrows(MalformedURLException.class,() -> checker.checkAllowList(urls("http://abc-1.com:8983", "abc-2")));- MatcherAssert.assertThat(e.getMessage(), containsString("abc-2"));+ assertThat(e.getMessage(), containsString("abc-2"));}@Test@@ -144,20 +143,19 @@ public class AllowListUrlCheckerTest extends SolrTestCaseJ4 {@Testpublic void testHostParsingUnsetEmpty() throws Exception {- MatcherAssert.assertThat(- AllowListUrlChecker.parseHostPorts(Collections.emptyList()).isEmpty(), is(true));+ assertThat(AllowListUrlChecker.parseHostPorts(Collections.emptyList()).isEmpty(), is(true));}@Testpublic void testHostParsingSingle() throws Exception {- MatcherAssert.assertThat(+ assertThat(AllowListUrlChecker.parseHostPorts(urls("http://abc-1.com:8983/solr/core1")),equalTo(hosts("abc-1.com:8983")));}@Testpublic void testHostParsingMulti() throws Exception {- MatcherAssert.assertThat(+ assertThat(AllowListUrlChecker.parseHostPorts(urls("http://abc-1.com:8983/solr/core1", "http://abc-1.com:8984/solr")),equalTo(hosts("abc-1.com:8983", "abc-1.com:8984")));@@ -165,7 +163,7 @@ public class AllowListUrlCheckerTest extends SolrTestCaseJ4 {@Testpublic void testHostParsingIpv4() throws Exception {- MatcherAssert.assertThat(+ assertThat(AllowListUrlChecker.parseHostPorts(urls("http://10.0.0.1:8983/solr/core1", "http://127.0.0.1:8984/solr")),equalTo(hosts("10.0.0.1:8983", "127.0.0.1:8984")));@@ -173,7 +171,7 @@ public class AllowListUrlCheckerTest extends SolrTestCaseJ4 {@Testpublic void testHostParsingIpv6() throws Exception {- MatcherAssert.assertThat(+ assertThat(AllowListUrlChecker.parseHostPorts(urls("http://[2001:abc:abc:0:0:123:456:1234]:8983/solr/core1",@@ -183,17 +181,17 @@ public class AllowListUrlCheckerTest extends SolrTestCaseJ4 {@Testpublic void testHostParsingHttps() throws Exception {- MatcherAssert.assertThat(+ assertThat(AllowListUrlChecker.parseHostPorts(urls("https://abc-1.com:8983/solr/core1")),equalTo(hosts("abc-1.com:8983")));}@Testpublic void testHostParsingNoProtocol() throws Exception {- MatcherAssert.assertThat(+ assertThat(AllowListUrlChecker.parseHostPorts(urls("abc-1.com:8983/solr")),equalTo(AllowListUrlChecker.parseHostPorts(urls("http://abc-1.com:8983/solr"))));- MatcherAssert.assertThat(+ assertThat(AllowListUrlChecker.parseHostPorts(urls("abc-1.com:8983/solr")),equalTo(AllowListUrlChecker.parseHostPorts(urls("https://abc-1.com:8983/solr"))));}diff --git a/solr/core/src/test/org/apache/solr/security/BaseTestRuleBasedAuthorizationPlugin.java b/solr/core/src/test/org/apache/solr/security/BaseTestRuleBasedAuthorizationPlugin.javaindex a19bfccb5c9..04d4f7e3cba 100644--- a/solr/core/src/test/org/apache/solr/security/BaseTestRuleBasedAuthorizationPlugin.java+++ b/solr/core/src/test/org/apache/solr/security/BaseTestRuleBasedAuthorizationPlugin.java@@ -55,7 +55,6 @@ import org.apache.solr.request.SolrRequestHandler;import org.apache.solr.security.AuthorizationContext.CollectionRequest;import org.apache.solr.security.AuthorizationContext.RequestType;import org.apache.solr.util.LogLevel;-import org.hamcrest.MatcherAssert;import org.hamcrest.core.IsInstanceOf;import org.junit.Before;import org.junit.Test;@@ -544,7 +543,7 @@ public class BaseTestRuleBasedAuthorizationPlugin extends SolrTestCaseJ4 {@Testpublic void testAllPermissionAllowsActionsWhenUserHasCorrectRole() {SolrRequestHandler handler = new UpdateRequestHandler();- MatcherAssert.assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));+ assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));setUserRole("dev", "dev");setUserRole("admin", "admin");addPermission("all", "dev", "admin");@@ -565,7 +564,7 @@ public class BaseTestRuleBasedAuthorizationPlugin extends SolrTestCaseJ4 {STATUS_OK);handler = new PropertiesRequestHandler();- MatcherAssert.assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));+ assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));checkRules(Map.of("resource",@@ -591,7 +590,7 @@ public class BaseTestRuleBasedAuthorizationPlugin extends SolrTestCaseJ4 {@Testpublic void testAllPermissionAllowsActionsWhenAssociatedRoleIsWildcard() {SolrRequestHandler handler = new UpdateRequestHandler();- MatcherAssert.assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));+ assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));setUserRole("dev", "dev");setUserRole("admin", "admin");addPermission("all", "*");@@ -612,7 +611,7 @@ public class BaseTestRuleBasedAuthorizationPlugin extends SolrTestCaseJ4 {STATUS_OK);handler = new PropertiesRequestHandler();- MatcherAssert.assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));+ assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));checkRules(Map.of("resource",@@ -638,7 +637,7 @@ public class BaseTestRuleBasedAuthorizationPlugin extends SolrTestCaseJ4 {@Testpublic void testAllPermissionDeniesActionsWhenUserIsNotCorrectRole() {SolrRequestHandler handler = new UpdateRequestHandler();- MatcherAssert.assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));+ assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));setUserRole("dev", "dev");setUserRole("admin", "admin");addPermission("all", "admin");@@ -659,7 +658,7 @@ public class BaseTestRuleBasedAuthorizationPlugin extends SolrTestCaseJ4 {FORBIDDEN);handler = new PropertiesRequestHandler();- MatcherAssert.assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));+ assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));checkRules(Map.of("resource",diff --git a/solr/core/src/test/org/apache/solr/servlet/TestRequestRateLimiter.java b/solr/core/src/test/org/apache/solr/servlet/TestRequestRateLimiter.javaindex a88c9f3f296..69a6cd0d303 100644--- a/solr/core/src/test/org/apache/solr/servlet/TestRequestRateLimiter.java+++ b/solr/core/src/test/org/apache/solr/servlet/TestRequestRateLimiter.java@@ -41,7 +41,6 @@ import org.apache.solr.common.SolrInputDocument;import org.apache.solr.common.cloud.SolrZkClient;import org.apache.solr.common.util.ExecutorUtil;import org.apache.solr.core.RateLimiterConfig;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;@@ -193,10 +192,10 @@ public class TestRequestRateLimiter extends SolrCloudTestCase {try {assertNotNull(future.get());} catch (ExecutionException e) {- MatcherAssert.assertThat(e.getCause().getCause(), instanceOf(RemoteSolrException.class));+ assertThat(e.getCause().getCause(), instanceOf(RemoteSolrException.class));RemoteSolrException rse = (RemoteSolrException) e.getCause().getCause();assertEquals(SolrException.ErrorCode.TOO_MANY_REQUESTS.code, rse.code());- MatcherAssert.assertThat(+ assertThat(rse.getMessage(), containsString("non ok status: 429, message:Too Many Requests"));}}diff --git a/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java b/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.javaindex 9dc7666bfbe..a54850f231b 100644--- a/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java+++ b/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java@@ -68,7 +68,6 @@ import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.search.SolrIndexSearcher;import org.apache.solr.util.RandomNoReverseMergePolicyFactory;import org.apache.solr.util.RefCounted;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.AfterClass;import org.junit.Before;@@ -328,7 +327,7 @@ public class AddBlockUpdateTest extends SolrTestCaseJ4 {SolrException thrown =assertThrows(SolrException.class, () -> indexSolrInputDocumentsDirectly(document1));- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),containsString("Anonymous child docs can only hang from others or the root"));}diff --git a/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java b/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.javaindex c6310c3600c..3dd77cc1155 100644--- a/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java+++ b/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java@@ -38,7 +38,6 @@ import org.apache.solr.common.SolrInputField;import org.apache.solr.common.util.ByteArrayUtf8CharSequence;import org.apache.solr.core.SolrCore;import org.apache.solr.schema.FieldType;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -357,7 +356,7 @@ public class DocumentBuilderTest extends SolrTestCaseJ4 {new KnnVectorField("vector", new float[] {1.1f, 2.1f, 3.1f, 4.1f}, VectorSimilarityFunction.COSINE);- MatcherAssert.assertThat(+ assertThat(((KnnFloatVectorField) out.getField("vector")).vectorValue(),is(expectedIndexableField.vectorValue()));@@ -365,12 +364,12 @@ public class DocumentBuilderTest extends SolrTestCaseJ4 {StreamSupport.stream(out.spliterator(), false).filter(f -> (f.fieldType().stored() && f.name().equals("vector"))).collect(Collectors.toList());- MatcherAssert.assertThat(storedFields.size(), is(4));+ assertThat(storedFields.size(), is(4));- MatcherAssert.assertThat(storedFields.get(0).numericValue(), is(1.1f));- MatcherAssert.assertThat(storedFields.get(1).numericValue(), is(2.1f));- MatcherAssert.assertThat(storedFields.get(2).numericValue(), is(3.1f));- MatcherAssert.assertThat(storedFields.get(3).numericValue(), is(4.1f));+ assertThat(storedFields.get(0).numericValue(), is(1.1f));+ assertThat(storedFields.get(1).numericValue(), is(2.1f));+ assertThat(storedFields.get(2).numericValue(), is(3.1f));+ assertThat(storedFields.get(3).numericValue(), is(4.1f));}@Test@@ -388,7 +387,7 @@ public class DocumentBuilderTest extends SolrTestCaseJ4 {new KnnVectorField("vector2", new float[] {1.1f, 2.1f, 3.1f, 4.1f}, VectorSimilarityFunction.DOT_PRODUCT);- MatcherAssert.assertThat(+ assertThat(((KnnFloatVectorField) out.getField("vector2")).vectorValue(),is(expectedDestination.vectorValue()));@@ -396,12 +395,12 @@ public class DocumentBuilderTest extends SolrTestCaseJ4 {StreamSupport.stream(out.spliterator(), false).filter(f -> (f.fieldType().stored() && f.name().equals("vector2"))).collect(Collectors.toList());- MatcherAssert.assertThat(storedFields.size(), is(4));+ assertThat(storedFields.size(), is(4));- MatcherAssert.assertThat(storedFields.get(0).numericValue(), is(1.1f));- MatcherAssert.assertThat(storedFields.get(1).numericValue(), is(2.1f));- MatcherAssert.assertThat(storedFields.get(2).numericValue(), is(3.1f));- MatcherAssert.assertThat(storedFields.get(3).numericValue(), is(4.1f));+ assertThat(storedFields.get(0).numericValue(), is(1.1f));+ assertThat(storedFields.get(1).numericValue(), is(2.1f));+ assertThat(storedFields.get(2).numericValue(), is(3.1f));+ assertThat(storedFields.get(3).numericValue(), is(4.1f));}@Test@@ -419,7 +418,7 @@ public class DocumentBuilderTest extends SolrTestCaseJ4 {() -> {DocumentBuilder.toDocument(doc, core.getLatestSchema());});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("ERROR: [doc=0] Error adding field 'vector3'='[1.1, 2.1, 3.1, 4.1]' msg=The copy field destination must be a DenseVectorField: vector_f_p"));@@ -440,11 +439,11 @@ public class DocumentBuilderTest extends SolrTestCaseJ4 {() -> {DocumentBuilder.toDocument(doc, core.getLatestSchema());});- MatcherAssert.assertThat(+ assertThat(thrown.getMessage(),is("ERROR: [doc=0] Error adding field 'vector4'='[1.1, 2.1, 3.1, 4.1]' msg=Error while creating field 'vector5{type=knn_vector5,properties=indexed,stored}' from value '[1.1, 2.1, 3.1, 4.1]'"));- MatcherAssert.assertThat(+ assertThat(thrown.getCause().getCause().getMessage(),is("incorrect vector dimension. The vector value has size 4 while it is expected a vector with size 5"));diff --git a/solr/core/src/test/org/apache/solr/update/DocumentBuilderVectorCatchAllCopyTest.java b/solr/core/src/test/org/apache/solr/update/DocumentBuilderVectorCatchAllCopyTest.javaindex 8abf333c7f0..cda41e76e0b 100644--- a/solr/core/src/test/org/apache/solr/update/DocumentBuilderVectorCatchAllCopyTest.java+++ b/solr/core/src/test/org/apache/solr/update/DocumentBuilderVectorCatchAllCopyTest.java@@ -30,7 +30,6 @@ import org.apache.lucene.index.VectorSimilarityFunction;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.core.SolrCore;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;@@ -59,7 +58,7 @@ public class DocumentBuilderVectorCatchAllCopyTest extends SolrTestCaseJ4 {new KnnVectorField("vector2", new float[] {1.1f, 2.1f, 3.1f, 4.1f}, VectorSimilarityFunction.DOT_PRODUCT);- MatcherAssert.assertThat(+ assertThat(((KnnFloatVectorField) out.getField("vector2")).vectorValue(),is(expectedDestination.vectorValue()));@@ -67,11 +66,11 @@ public class DocumentBuilderVectorCatchAllCopyTest extends SolrTestCaseJ4 {StreamSupport.stream(out.spliterator(), false).filter(f -> (f.fieldType().stored() && f.name().equals("vector2"))).collect(Collectors.toList());- MatcherAssert.assertThat(storedFields.size(), is(4));+ assertThat(storedFields.size(), is(4));- MatcherAssert.assertThat(storedFields.get(0).numericValue(), is(1.1f));- MatcherAssert.assertThat(storedFields.get(1).numericValue(), is(2.1f));- MatcherAssert.assertThat(storedFields.get(2).numericValue(), is(3.1f));- MatcherAssert.assertThat(storedFields.get(3).numericValue(), is(4.1f));+ assertThat(storedFields.get(0).numericValue(), is(1.1f));+ assertThat(storedFields.get(1).numericValue(), is(2.1f));+ assertThat(storedFields.get(2).numericValue(), is(3.1f));+ assertThat(storedFields.get(3).numericValue(), is(4.1f));}}diff --git a/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java b/solr/core/src/test/org/apache/solr/update/PeerSyncTest.javaindex 3931dfb6394..7c90901d00d 100644--- a/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java+++ b/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java@@ -42,7 +42,6 @@ import org.apache.solr.schema.IndexSchema;import org.apache.solr.update.PeerSync.MissedUpdatesRequest;import org.apache.solr.update.processor.DistributedUpdateProcessor;import org.apache.solr.update.processor.DistributedUpdateProcessor.DistribPhase;-import org.hamcrest.MatcherAssert;import org.junit.Test;@SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776")@@ -349,7 +348,7 @@ public class PeerSyncTest extends BaseDistributedSearchTestCase {add(client0, inPlaceParams, sdoc("id", 6000, "val_i_dvo", 6003, "_version_", 5007));});assertEquals(ex.toString(), SolrException.ErrorCode.SERVER_ERROR.code, ex.code());- MatcherAssert.assertThat(ex.getMessage(), containsString("Can't find document with id=6000"));+ assertThat(ex.getMessage(), containsString("Can't find document with id=6000"));// Reordered DBQ with Child-nodes (SOLR-10114)docsAdded.clear();diff --git a/solr/core/src/test/org/apache/solr/update/RootFieldTest.java b/solr/core/src/test/org/apache/solr/update/RootFieldTest.javaindex 8529bb88c99..b11da415045 100644--- a/solr/core/src/test/org/apache/solr/update/RootFieldTest.java+++ b/solr/core/src/test/org/apache/solr/update/RootFieldTest.java@@ -30,7 +30,6 @@ import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.common.params.CommonParams;import org.apache.solr.util.RandomNoReverseMergePolicyFactory;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.ClassRule;import org.junit.Test;@@ -86,15 +85,15 @@ public class RootFieldTest extends EmbeddedSolrServerTestBase {query.set(CommonParams.FL, "id,name,_root_");SolrDocumentList results = client.query(query).getResults();- MatcherAssert.assertThat(results.getNumFound(), is(1L));+ assertThat(results.getNumFound(), is(1L));SolrDocument foundDoc = results.get(0);// Check retrieved field values- MatcherAssert.assertThat(foundDoc.getFieldValue("id"), is(docId));- MatcherAssert.assertThat(foundDoc.getFieldValue("name"), is("child free doc"));+ assertThat(foundDoc.getFieldValue("id"), is(docId));+ assertThat(foundDoc.getFieldValue("name"), is("child free doc"));String expectedRootValue = expectRoot() ? docId : null;- MatcherAssert.assertThat(MESSAGE, foundDoc.getFieldValue("_root_"), is(expectedRootValue));+ assertThat(MESSAGE, foundDoc.getFieldValue("_root_"), is(expectedRootValue));// Update the docdocToUpdate.setField("name", "updated doc");@@ -106,9 +105,9 @@ public class RootFieldTest extends EmbeddedSolrServerTestBase {foundDoc = results.get(0);// Check updated field values- MatcherAssert.assertThat(foundDoc.getFieldValue("id"), is(docId));- MatcherAssert.assertThat(foundDoc.getFieldValue("name"), is("updated doc"));- MatcherAssert.assertThat(MESSAGE, foundDoc.getFieldValue("_root_"), is(expectedRootValue));+ assertThat(foundDoc.getFieldValue("id"), is(docId));+ assertThat(foundDoc.getFieldValue("name"), is("updated doc"));+ assertThat(MESSAGE, foundDoc.getFieldValue("_root_"), is(expectedRootValue));}@Testdiff --git a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdateWithRouteField.java b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdateWithRouteField.javaindex 731d65ce02c..d59b6f898da 100644--- a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdateWithRouteField.java+++ b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdateWithRouteField.java@@ -42,7 +42,6 @@ import org.apache.solr.common.SolrDocumentList;import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.common.params.UpdateParams;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;@@ -92,7 +91,7 @@ public class TestInPlaceUpdateWithRouteField extends SolrCloudTestCase {Long initialVersion = (Long) solrDocument.get("_version_");Integer luceneDocId = (Integer) solrDocument.get("[docid]");String shardName = (String) solrDocument.get("shardName");- MatcherAssert.assertThat(solrDocument.get("inplace_updatable_int"), is(id));+ assertThat(solrDocument.get("inplace_updatable_int"), is(id));int newDocValue = TestUtil.nextInt(random(), 1, 2 * NUMBER_OF_DOCS - 1);SolrInputDocument sdoc =@@ -120,9 +119,9 @@ public class TestInPlaceUpdateWithRouteField extends SolrCloudTestCase {assertTrue("Version of updated document must be greater than original one",newVersion > initialVersion);- MatcherAssert.assertThat(+ assertThat("Doc value must be updated", solrDocument.get("inplace_updatable_int"), is(newDocValue));- MatcherAssert.assertThat(+ assertThat("Lucene doc id should not be changed for In-Place Updates.",solrDocument.get("[docid]"),is(luceneDocId));@@ -147,8 +146,7 @@ public class TestInPlaceUpdateWithRouteField extends SolrCloudTestCase {r.process(cluster.getSolrClient(), COLLECTION);});assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(- e.getMessage(), containsString("Unable to update doc in-place: " + id));+ assertThat(e.getMessage(), containsString("Unable to update doc in-place: " + id));}private void checkWrongCommandFailure(SolrInputDocument sdoc)@@ -157,7 +155,7 @@ public class TestInPlaceUpdateWithRouteField extends SolrCloudTestCase {new UpdateRequest().add(sdoc).process(cluster.getSolrClient(), COLLECTION);fail("expect an exception for wrong update command");} catch (SolrException ex) {- MatcherAssert.assertThat("expecting 400 in " + ex.getMessage(), ex.code(), is(400));+ assertThat("expecting 400 in " + ex.getMessage(), ex.code(), is(400));}}@@ -182,7 +180,7 @@ public class TestInPlaceUpdateWithRouteField extends SolrCloudTestCase {COLLECTION);QueryResponse response = cluster.getSolrClient().query(COLLECTION, query);SolrDocumentList result = (SolrDocumentList) response.getResponse().get("response");- MatcherAssert.assertThat(result.getNumFound(), is(1L));+ assertThat(result.getNumFound(), is(1L));return result.get(0);}}diff --git a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.javaindex 33ee84a376b..fe75428c695 100644--- a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java+++ b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java@@ -64,7 +64,6 @@ import org.apache.solr.update.processor.DistributedUpdateProcessor;import org.apache.solr.util.RefCounted;import org.apache.solr.util.TimeOut;import org.apache.zookeeper.KeeperException;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;import org.slf4j.Logger;@@ -818,7 +817,7 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {addDocAndGetVersion("id", 100, "inplace_updatable_float", map("set", "NOT_NUMBER")));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(e.getMessage(), containsString("For input string: \"NOT_NUMBER\""));+ assertThat(e.getMessage(), containsString("For input string: \"NOT_NUMBER\""));// inc operation with invalid inc valuee =@@ -827,7 +826,7 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {() ->addDocAndGetVersion("id", 100, "inplace_updatable_int", map("inc", "NOT_NUMBER")));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(e.getMessage(), containsString("For input string: \"NOT_NUMBER\""));+ assertThat(e.getMessage(), containsString("For input string: \"NOT_NUMBER\""));// RTG from tlog(s)for (SolrClient client : clients) {diff --git a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.javaindex 3795204a7b2..6c26ff47a88 100644--- a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java+++ b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java@@ -52,7 +52,6 @@ import org.apache.solr.schema.IndexSchema;import org.apache.solr.schema.SchemaField;import org.apache.solr.update.processor.AtomicUpdateDocumentMerger;import org.apache.solr.util.RefCounted;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.Before;import org.junit.BeforeClass;@@ -136,7 +135,7 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {addAndAssertVersion(version1, "id", "1", "inplace_updatable_float", map("set", "NOT_NUMBER")));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(e.getMessage(), containsString("For input string: \"NOT_NUMBER\""));+ assertThat(e.getMessage(), containsString("For input string: \"NOT_NUMBER\""));// invalid value with inc operatione =@@ -146,7 +145,7 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {addAndAssertVersion(version1, "id", "1", "inplace_updatable_float", map("inc", "NOT_NUMBER")));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(e.getMessage(), containsString("For input string: \"NOT_NUMBER\""));+ assertThat(e.getMessage(), containsString("For input string: \"NOT_NUMBER\""));// inc op with null valuee =@@ -156,7 +155,7 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {addAndAssertVersion(version1, "id", "1", "inplace_updatable_float", map("inc", null)));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(+ assertThat(e.getMessage(), containsString("Invalid input 'null' for field inplace_updatable_float"));e =@@ -170,7 +169,7 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {"inplace_updatable_float",map("inc", new ArrayList<>(Collections.singletonList(123)))));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(+ assertThat(e.getMessage(), containsString("Invalid input '[123]' for field inplace_updatable_float"));// regular atomic update should fail if user says they only want in-place atomic updates...@@ -182,7 +181,7 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {sdoc("id", "1", "regular_l", map("inc", 1)),params(UpdateParams.REQUIRE_PARTIAL_DOC_UPDATES_INPLACE, "true")));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(e.getMessage(), containsString("Unable to update doc in-place: 1"));+ assertThat(e.getMessage(), containsString("Unable to update doc in-place: 1"));}@Test@@ -334,8 +333,8 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {null);});assertEquals(exception.toString(), SolrException.ErrorCode.CONFLICT.code, exception.code());- MatcherAssert.assertThat(exception.getMessage(), containsString("expected=-1"));- MatcherAssert.assertThat(exception.getMessage(), containsString("actual=" + v20));+ assertThat(exception.getMessage(), containsString("expected=-1"));+ assertThat(exception.getMessage(), containsString("actual=" + v20));long oldV20 = v20;v20 =@@ -350,8 +349,8 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {null);});assertEquals(exception.toString(), SolrException.ErrorCode.CONFLICT.code, exception.code());- MatcherAssert.assertThat(exception.getMessage(), containsString("expected=" + oldV20));- MatcherAssert.assertThat(exception.getMessage(), containsString("actual=" + v20));+ assertThat(exception.getMessage(), containsString("expected=" + oldV20));+ assertThat(exception.getMessage(), containsString("actual=" + v20));v20 =addAndAssertVersion(@@ -457,7 +456,7 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {SolrException.class,() -> addAndGetVersion(sdoc("id", "1", "regular_l", map("inc", 1)), require_inplace));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(e.getMessage(), containsString("Unable to update doc in-place: 1"));+ assertThat(e.getMessage(), containsString("Unable to update doc in-place: 1"));// data in solr should be unchanged after failed attempt at non-inplace atomic update...assertU(commit("softCommit", "false"));diff --git a/solr/core/src/test/org/apache/solr/update/TestNestedUpdateProcessor.java b/solr/core/src/test/org/apache/solr/update/TestNestedUpdateProcessor.javaindex c2c080d7a0e..c91cdf27257 100644--- a/solr/core/src/test/org/apache/solr/update/TestNestedUpdateProcessor.java+++ b/solr/core/src/test/org/apache/solr/update/TestNestedUpdateProcessor.java@@ -35,7 +35,6 @@ import org.apache.solr.schema.IndexSchema;import org.apache.solr.update.processor.NestedUpdateProcessorFactory;import org.apache.solr.update.processor.UpdateRequestProcessor;import org.apache.solr.util.RandomNoReverseMergePolicyFactory;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.BeforeClass;import org.junit.ClassRule;@@ -271,7 +270,7 @@ public class TestNestedUpdateProcessor extends SolrTestCaseJ4 {final String errMsg ="contains: '" + PATH_SEP_CHAR + "' , which is reserved for the nested URP";SolrException thrown = assertThrows(SolrException.class, () -> indexSampleData(errDoc));- MatcherAssert.assertThat(thrown.getMessage(), containsString(errMsg));+ assertThat(thrown.getMessage(), containsString(errMsg));}private void indexSampleData(String cmd) throws Exception {diff --git a/solr/core/src/test/org/apache/solr/update/UpdateLogTest.java b/solr/core/src/test/org/apache/solr/update/UpdateLogTest.javaindex 34a2f194016..6a35c3df32c 100644--- a/solr/core/src/test/org/apache/solr/update/UpdateLogTest.java+++ b/solr/core/src/test/org/apache/solr/update/UpdateLogTest.java@@ -28,7 +28,6 @@ import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.handler.component.RealTimeGetComponent;import org.apache.solr.request.SolrQueryRequest;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -182,9 +181,8 @@ public class UpdateLogTest extends SolrTestCaseJ4 {+ returnVal);});assertEquals(ex.toString(), SolrException.ErrorCode.INVALID_STATE.code, ex.code());- MatcherAssert.assertThat(- ex.getMessage(), containsString("should've been either ADD or UPDATE_INPLACE"));- MatcherAssert.assertThat(ex.getMessage(), containsString("looking for id=1"));+ assertThat(ex.getMessage(), containsString("should've been either ADD or UPDATE_INPLACE"));+ assertThat(ex.getMessage(), containsString("looking for id=1"));}@Testdiff --git a/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java b/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.javaindex d0ce6058dbe..ee31cd1077e 100644--- a/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java+++ b/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java@@ -39,7 +39,6 @@ import org.apache.solr.client.solrj.SolrServerException;import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.RequestWriterSupplier;import org.apache.solr.client.solrj.response.QueryResponse;import org.apache.solr.common.util.ByteArrayUtf8CharSequence;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.Test;@@ -95,14 +94,14 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase extends EmbeddedSoCollection<Object> fieldValues = getSolrClient().getById("20000").getFieldValues(fieldName);assertEquals(3, fieldValues.size());- MatcherAssert.assertThat(+ assertThat(fieldValues, hasItems(vc.apply(values[0]), vc.apply(values[1]), vc.apply(values[2])));- MatcherAssert.assertThat(fieldValues, not(hasItems(vc.apply(values[3]))));+ assertThat(fieldValues, not(hasItems(vc.apply(values[3]))));fieldValues = getSolrClient().getById("20001").getFieldValues(fieldName);assertEquals(3, fieldValues.size());- MatcherAssert.assertThat(+ assertThat(fieldValues, hasItems(vc.apply(values[1]), vc.apply(values[2]), vc.apply(values[3])));- MatcherAssert.assertThat(fieldValues, not(hasItems(vc.apply(values[0]))));+ assertThat(fieldValues, not(hasItems(vc.apply(values[0]))));getSolrClient().add(sdoc("id", "20000", fieldName, Map.of("remove", List.of(values[0]))));getSolrClient().commit(true, true);@@ -116,13 +115,13 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase extends EmbeddedSofieldValues = getSolrClient().getById("20000").getFieldValues(fieldName);assertEquals(2, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(vc.apply(values[1]), vc.apply(values[2])));- MatcherAssert.assertThat(fieldValues, not(hasItems(vc.apply(values[0]), vc.apply(values[3]))));+ assertThat(fieldValues, hasItems(vc.apply(values[1]), vc.apply(values[2])));+ assertThat(fieldValues, not(hasItems(vc.apply(values[0]), vc.apply(values[3]))));fieldValues = getSolrClient().getById("20001").getFieldValues(fieldName);assertEquals(3, fieldValues.size());- MatcherAssert.assertThat(+ assertThat(fieldValues, hasItems(vc.apply(values[1]), vc.apply(values[2]), vc.apply(values[3])));- MatcherAssert.assertThat(fieldValues, not(hasItems(vc.apply(values[0]))));+ assertThat(fieldValues, not(hasItems(vc.apply(values[0]))));getSolrClient().add(@@ -142,12 +141,12 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase extends EmbeddedSofieldValues = getSolrClient().getById("20000").getFieldValues(fieldName);assertEquals(2, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(vc.apply(values[1]), vc.apply(values[2])));- MatcherAssert.assertThat(fieldValues, not(hasItems(vc.apply(values[0]), vc.apply(values[3]))));+ assertThat(fieldValues, hasItems(vc.apply(values[1]), vc.apply(values[2])));+ assertThat(fieldValues, not(hasItems(vc.apply(values[0]), vc.apply(values[3]))));fieldValues = getSolrClient().getById("20001").getFieldValues(fieldName);assertEquals(1, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(vc.apply(values[3])));- MatcherAssert.assertThat(+ assertThat(fieldValues, hasItems(vc.apply(values[3])));+ assertThat(fieldValues, not(hasItems(vc.apply(values[0]), vc.apply(values[1]), vc.apply(values[2]))));getSolrClient()@@ -174,13 +173,13 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase extends EmbeddedSofieldValues = getSolrClient().getById("20000").getFieldValues(fieldName);assertEquals(1, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(vc.apply(values[0])));- MatcherAssert.assertThat(+ assertThat(fieldValues, hasItems(vc.apply(values[0])));+ assertThat(fieldValues, not(hasItems(vc.apply(values[1]), vc.apply(values[2]), vc.apply(values[3]))));fieldValues = getSolrClient().getById("20001").getFieldValues(fieldName);assertEquals(1, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(vc.apply(values[0])));- MatcherAssert.assertThat(+ assertThat(fieldValues, hasItems(vc.apply(values[0])));+ assertThat(fieldValues, not(hasItems(vc.apply(values[1]), vc.apply(values[2]), vc.apply(values[3]))));getSolrClient()@@ -207,13 +206,13 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase extends EmbeddedSofieldValues = getSolrClient().getById("20000").getFieldValues(fieldName);assertEquals(4, fieldValues.size());- MatcherAssert.assertThat(+ assertThat(fieldValues,hasItems(vc.apply(values[0]), vc.apply(values[1]), vc.apply(values[2]), vc.apply(values[3])));fieldValues = getSolrClient().getById("20001").getFieldValues(fieldName);assertEquals(4, fieldValues.size());- MatcherAssert.assertThat(+ assertThat(fieldValues,hasItems(vc.apply(values[0]), vc.apply(values[1]), vc.apply(values[2]), vc.apply(values[3])));@@ -275,10 +274,10 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase extends EmbeddedSoCollection<Object> fieldValues = getSolrClient().getById("20000").getFieldValues(fieldName);assertEquals(2, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(true, false));+ assertThat(fieldValues, hasItems(true, false));fieldValues = getSolrClient().getById("20001").getFieldValues(fieldName);assertEquals(2, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(true, false));+ assertThat(fieldValues, hasItems(true, false));getSolrClient().add(sdoc("id", "20000", fieldName, Map.of("remove", List.of(false))));getSolrClient().commit(true, true);@@ -288,10 +287,10 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase extends EmbeddedSofieldValues = getSolrClient().getById("20000").getFieldValues(fieldName);assertEquals(1, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(true));+ assertThat(fieldValues, hasItems(true));fieldValues = getSolrClient().getById("20001").getFieldValues(fieldName);assertEquals(2, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(true, false));+ assertThat(fieldValues, hasItems(true, false));getSolrClient().add(sdoc("id", "20001", fieldName, Map.of("remove", List.of(true, false))));getSolrClient().commit(true, true);@@ -301,8 +300,8 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase extends EmbeddedSofieldValues = getSolrClient().getById("20000").getFieldValues(fieldName);assertEquals(1, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(true));- MatcherAssert.assertThat(fieldValues, not(hasItems(false)));+ assertThat(fieldValues, hasItems(true));+ assertThat(fieldValues, not(hasItems(false)));fieldValues = getSolrClient().getById("20001").getFieldValues(fieldName);assertNull(fieldValues);@@ -315,7 +314,7 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase extends EmbeddedSofieldValues = getSolrClient().getById("20000").getFieldValues(fieldName);assertEquals(3, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(true, false));+ assertThat(fieldValues, hasItems(true, false));fieldValues = getSolrClient().getById("20001").getFieldValues(fieldName);assertNull(fieldValues);@@ -331,10 +330,10 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase extends EmbeddedSofieldValues = getSolrClient().getById("20000").getFieldValues(fieldName);assertEquals(2, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(true, false));+ assertThat(fieldValues, hasItems(true, false));fieldValues = getSolrClient().getById("20001").getFieldValues(fieldName);assertEquals(2, fieldValues.size());- MatcherAssert.assertThat(fieldValues, hasItems(true, false));+ assertThat(fieldValues, hasItems(true, false));}@Testdiff --git a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.javaindex 36ba8f9ca61..5194e1ea1ba 100644--- a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java+++ b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java@@ -28,7 +28,6 @@ import org.apache.solr.common.SolrException;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.util.DateMathParser;import org.apache.solr.util.RandomNoReverseMergePolicyFactory;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.BeforeClass;import org.junit.ClassRule;@@ -1542,8 +1541,7 @@ public class AtomicUpdatesTest extends SolrTestCaseJ4 {SolrException e = expectThrows(SolrException.class, () -> assertU(adoc(invalidDoc)));assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, e.code());- MatcherAssert.assertThat(- e.getMessage(), containsString("'inc' is not supported on non-numeric field cat"));+ assertThat(e.getMessage(), containsString("'inc' is not supported on non-numeric field cat"));}public void testFieldsWithDefaultValuesWhenAtomicUpdatesAgainstTlog() {diff --git a/solr/core/src/test/org/apache/solr/update/processor/ClassificationUpdateProcessorFactoryTest.java b/solr/core/src/test/org/apache/solr/update/processor/ClassificationUpdateProcessorFactoryTest.javaindex 1615c483bd9..a68c41adad4 100644--- a/solr/core/src/test/org/apache/solr/update/processor/ClassificationUpdateProcessorFactoryTest.java+++ b/solr/core/src/test/org/apache/solr/update/processor/ClassificationUpdateProcessorFactoryTest.java@@ -24,7 +24,6 @@ import org.apache.solr.common.SolrException;import org.apache.solr.common.util.NamedList;import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.response.SolrQueryResponse;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.Test;@@ -85,7 +84,7 @@ public class ClassificationUpdateProcessorFactoryTest extends SolrTestCaseJ4 {ClassificationUpdateProcessorParams classificationParams =cFactoryToTest.getClassificationParams();- MatcherAssert.assertThat(classificationParams.getPredictedClassField(), is("classField1"));+ assertThat(classificationParams.getPredictedClassField(), is("classField1"));}@Testdiff --git a/solr/core/src/test/org/apache/solr/update/processor/ClassificationUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/ClassificationUpdateProcessorTest.javaindex 8108ae658e0..3e4cbeee234 100644--- a/solr/core/src/test/org/apache/solr/update/processor/ClassificationUpdateProcessorTest.java+++ b/solr/core/src/test/org/apache/solr/update/processor/ClassificationUpdateProcessorTest.java@@ -36,7 +36,6 @@ import org.apache.lucene.tests.index.RandomIndexWriter;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.update.AddUpdateCommand;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;import org.junit.Test;@@ -105,7 +104,7 @@ public class ClassificationUpdateProcessorTest extends SolrTestCaseJ4 {new ClassificationUpdateProcessor(params, mockProcessor, reader, req().getSchema());updateProcessorToTest.processAdd(update);- MatcherAssert.assertThat(unseenDocument1.getFieldValue(PREDICTED_CLASS), is("class2"));+ assertThat(unseenDocument1.getFieldValue(PREDICTED_CLASS), is("class2"));}@Test@@ -125,7 +124,7 @@ public class ClassificationUpdateProcessorTest extends SolrTestCaseJ4 {new ClassificationUpdateProcessor(params, mockProcessor, reader, req().getSchema());updateProcessorToTest.processAdd(update);- MatcherAssert.assertThat(unseenDocument1.getFieldValue(TRAINING_CLASS), is("class2"));+ assertThat(unseenDocument1.getFieldValue(TRAINING_CLASS), is("class2"));}@Test@@ -147,7 +146,7 @@ public class ClassificationUpdateProcessorTest extends SolrTestCaseJ4 {updateProcessorToTest.processAdd(update);- MatcherAssert.assertThat(unseenDocument1.getFieldValue(TRAINING_CLASS), is("class2"));+ assertThat(unseenDocument1.getFieldValue(TRAINING_CLASS), is("class2"));}@Test@@ -167,7 +166,7 @@ public class ClassificationUpdateProcessorTest extends SolrTestCaseJ4 {new ClassificationUpdateProcessor(params, mockProcessor, reader, req().getSchema());updateProcessorToTest.processAdd(update);- MatcherAssert.assertThat(unseenDocument1.getFieldValue(TRAINING_CLASS), is("class1"));+ assertThat(unseenDocument1.getFieldValue(TRAINING_CLASS), is("class1"));}@Test@@ -189,7 +188,7 @@ public class ClassificationUpdateProcessorTest extends SolrTestCaseJ4 {new ClassificationUpdateProcessor(params, mockProcessor, reader, req().getSchema());updateProcessorToTest.processAdd(update);- MatcherAssert.assertThat(unseenDocument1.getFieldValue(TRAINING_CLASS), is("class3"));+ assertThat(unseenDocument1.getFieldValue(TRAINING_CLASS), is("class3"));}@Test@@ -211,7 +210,7 @@ public class ClassificationUpdateProcessorTest extends SolrTestCaseJ4 {updateProcessorToTest.processAdd(update);- MatcherAssert.assertThat(unseenDocument1.getFieldValue(TRAINING_CLASS), is("class2"));+ assertThat(unseenDocument1.getFieldValue(TRAINING_CLASS), is("class2"));}@Test@@ -235,8 +234,8 @@ public class ClassificationUpdateProcessorTest extends SolrTestCaseJ4 {@SuppressWarnings({"unchecked"})ArrayList<Object> assignedClasses = (ArrayList) unseenDocument1.getFieldValues(TRAINING_CLASS);- MatcherAssert.assertThat(assignedClasses.get(0), is("class2"));- MatcherAssert.assertThat(assignedClasses.get(1), is("class1"));+ assertThat(assignedClasses.get(0), is("class2"));+ assertThat(assignedClasses.get(1), is("class1"));}@Test@@ -259,9 +258,9 @@ public class ClassificationUpdateProcessorTest extends SolrTestCaseJ4 {@SuppressWarnings({"unchecked"})ArrayList<Object> assignedClasses = (ArrayList) unseenDocument1.getFieldValues(TRAINING_CLASS);- MatcherAssert.assertThat(assignedClasses.size(), is(2));- MatcherAssert.assertThat(assignedClasses.get(0), is("class2"));- MatcherAssert.assertThat(assignedClasses.get(1), is("class1"));+ assertThat(assignedClasses.size(), is(2));+ assertThat(assignedClasses.get(0), is("class2"));+ assertThat(assignedClasses.get(1), is("class1"));}@Test@@ -284,9 +283,9 @@ public class ClassificationUpdateProcessorTest extends SolrTestCaseJ4 {@SuppressWarnings({"unchecked"})ArrayList<Object> assignedClasses = (ArrayList) unseenDocument1.getFieldValues(TRAINING_CLASS);- MatcherAssert.assertThat(assignedClasses.size(), is(2));- MatcherAssert.assertThat(assignedClasses.get(0), is("class2"));- MatcherAssert.assertThat(assignedClasses.get(1), is("class1"));+ assertThat(assignedClasses.size(), is(2));+ assertThat(assignedClasses.get(0), is("class2"));+ assertThat(assignedClasses.get(1), is("class1"));}@Test@@ -312,9 +311,9 @@ public class ClassificationUpdateProcessorTest extends SolrTestCaseJ4 {@SuppressWarnings({"unchecked"})ArrayList<Object> assignedClasses = (ArrayList) unseenDocument1.getFieldValues(TRAINING_CLASS);- MatcherAssert.assertThat(assignedClasses.size(), is(2));- MatcherAssert.assertThat(assignedClasses.get(0), is("class4"));- MatcherAssert.assertThat(assignedClasses.get(1), is("class6"));+ assertThat(assignedClasses.size(), is(2));+ assertThat(assignedClasses.get(0), is("class4"));+ assertThat(assignedClasses.get(1), is("class6"));}@Test@@ -340,9 +339,9 @@ public class ClassificationUpdateProcessorTest extends SolrTestCaseJ4 {@SuppressWarnings({"unchecked"})ArrayList<Object> assignedClasses = (ArrayList) unseenDocument1.getFieldValues(TRAINING_CLASS);- MatcherAssert.assertThat(assignedClasses.size(), is(2));- MatcherAssert.assertThat(assignedClasses.get(0), is("class4"));- MatcherAssert.assertThat(assignedClasses.get(1), is("class6"));+ assertThat(assignedClasses.size(), is(2));+ assertThat(assignedClasses.get(0), is("class4"));+ assertThat(assignedClasses.get(1), is("class6"));}private ClassificationUpdateProcessorParams initParams(diff --git a/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.javaindex 874201b9ae4..a1289db36a7 100644--- a/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.java+++ b/solr/core/src/test/org/apache/solr/update/processor/DistributedUpdateProcessorTest.java@@ -40,7 +40,6 @@ import org.apache.solr.update.DeleteUpdateCommand;import org.apache.solr.update.TimedVersionBucket;import org.apache.solr.update.UpdateLog;import org.apache.solr.update.VersionInfo;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Rule;@@ -106,11 +105,11 @@ public class DistributedUpdateProcessorTest extends SolrTestCaseJ4 {};int succeeded = runCommands(threads, 1000, req, versionAddFunc);// only one should succeed- MatcherAssert.assertThat(succeeded, is(1));+ assertThat(succeeded, is(1));succeeded = runCommands(threads, -1, req, versionAddFunc);// all should succeed- MatcherAssert.assertThat(succeeded, is(threads));+ assertThat(succeeded, is(threads));}@Test@@ -131,11 +130,11 @@ public class DistributedUpdateProcessorTest extends SolrTestCaseJ4 {int succeeded = runCommands(threads, 1000, req, versionDeleteFunc);// only one should succeed- MatcherAssert.assertThat(succeeded, is(1));+ assertThat(succeeded, is(1));succeeded = runCommands(threads, -1, req, versionDeleteFunc);// all should succeed- MatcherAssert.assertThat(succeeded, is(threads));+ assertThat(succeeded, is(threads));}/**diff --git a/solr/core/src/test/org/apache/solr/update/processor/IgnoreLargeDocumentProcessorFactoryTest.java b/solr/core/src/test/org/apache/solr/update/processor/IgnoreLargeDocumentProcessorFactoryTest.javaindex 8b06b16f080..513b0589157 100644--- a/solr/core/src/test/org/apache/solr/update/processor/IgnoreLargeDocumentProcessorFactoryTest.java+++ b/solr/core/src/test/org/apache/solr/update/processor/IgnoreLargeDocumentProcessorFactoryTest.java@@ -31,7 +31,6 @@ import org.apache.solr.common.SolrInputDocument;import org.apache.solr.common.util.NamedList;import org.apache.solr.update.AddUpdateCommand;import org.apache.solr.util.LogListener;-import org.hamcrest.MatcherAssert;import org.junit.Test;public class IgnoreLargeDocumentProcessorFactoryTest extends SolrTestCase {@@ -68,7 +67,7 @@ public class IgnoreLargeDocumentProcessorFactoryTest extends SolrTestCase {try (LogListener listener = LogListener.warn(IgnoreLargeDocumentProcessorFactory.class)) {processor.processAdd(getUpdate(1024));- MatcherAssert.assertThat(+ assertThat(listener.pollMessage(),containsString("Skipping doc because estimated size exceeds limit"));}diff --git a/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.java b/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.javaindex 0e2e0c2476a..ca28d1333be 100644--- a/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.java+++ b/solr/core/src/test/org/apache/solr/update/processor/TestDocBasedVersionConstraints.java@@ -36,7 +36,6 @@ import org.apache.solr.common.util.NamedList;import org.apache.solr.common.util.SolrNamedThreadFactory;import org.apache.solr.schema.IndexSchema;import org.apache.solr.schema.SchemaField;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.BeforeClass;@@ -697,7 +696,7 @@ public class TestDocBasedVersionConstraints extends SolrTestCaseJ4 {config.add("versionField", "_version_");factory.init(config);IndexSchema schema = h.getCore().getLatestSchema();- MatcherAssert.assertThat(factory.canCreateTombstoneDocument(schema), is(true));+ assertThat(factory.canCreateTombstoneDocument(schema), is(true));}public void testCanCreateTombstonesMissingRequiredField() {@@ -708,11 +707,11 @@ public class TestDocBasedVersionConstraints extends SolrTestCaseJ4 {factory.init(config);IndexSchema schema = h.getCore().getLatestSchema();SchemaField sf = schema.getField("sku1");- MatcherAssert.assertThat(sf, is(not(nullValue())));- MatcherAssert.assertThat(schema.getRequiredFields(), not(hasItem(sf)));+ assertThat(sf, is(not(nullValue())));+ assertThat(schema.getRequiredFields(), not(hasItem(sf)));try {schema.getRequiredFields().add(sf);- MatcherAssert.assertThat(factory.canCreateTombstoneDocument(schema), is(false));+ assertThat(factory.canCreateTombstoneDocument(schema), is(false));} finally {schema.getRequiredFields().remove(sf);}@@ -729,7 +728,7 @@ public class TestDocBasedVersionConstraints extends SolrTestCaseJ4 {SchemaField sf2 = new SchemaField("sku1_with_default", sf.getType(), sf.getProperties(), "foo");try {schema.getRequiredFields().add(sf2);- MatcherAssert.assertThat(factory.canCreateTombstoneDocument(schema), is(true));+ assertThat(factory.canCreateTombstoneDocument(schema), is(true));} finally {schema.getRequiredFields().remove(sf2);}@@ -746,11 +745,11 @@ public class TestDocBasedVersionConstraints extends SolrTestCaseJ4 {factory.init(config);IndexSchema schema = h.getCore().getLatestSchema();SchemaField sf = schema.getField("sku1");- MatcherAssert.assertThat(sf, is(not(nullValue())));- MatcherAssert.assertThat(schema.getRequiredFields(), not(hasItem(sf)));+ assertThat(sf, is(not(nullValue())));+ assertThat(schema.getRequiredFields(), not(hasItem(sf)));try {schema.getRequiredFields().add(sf);- MatcherAssert.assertThat(factory.canCreateTombstoneDocument(schema), is(true));+ assertThat(factory.canCreateTombstoneDocument(schema), is(true));} finally {schema.getRequiredFields().remove(sf);}@@ -764,11 +763,11 @@ public class TestDocBasedVersionConstraints extends SolrTestCaseJ4 {factory.init(config);IndexSchema schema = h.getCore().getLatestSchema();SchemaField versionField = schema.getField("_version_");- MatcherAssert.assertThat(versionField, is(not(nullValue())));- MatcherAssert.assertThat(schema.getRequiredFields(), not(hasItem(versionField)));+ assertThat(versionField, is(not(nullValue())));+ assertThat(schema.getRequiredFields(), not(hasItem(versionField)));try {schema.getRequiredFields().add(versionField);- MatcherAssert.assertThat(factory.canCreateTombstoneDocument(schema), is(true));+ assertThat(factory.canCreateTombstoneDocument(schema), is(true));} finally {schema.getRequiredFields().remove(versionField);}@@ -782,10 +781,10 @@ public class TestDocBasedVersionConstraints extends SolrTestCaseJ4 {factory.init(config);IndexSchema schema = h.getCore().getLatestSchema();SchemaField uniqueKeyField = schema.getField("id");- MatcherAssert.assertThat(uniqueKeyField, is(not(nullValue())));- MatcherAssert.assertThat(uniqueKeyField, equalTo(schema.getUniqueKeyField()));- MatcherAssert.assertThat(schema.getRequiredFields(), hasItem(schema.getUniqueKeyField()));- MatcherAssert.assertThat(factory.canCreateTombstoneDocument(schema), is(true));+ assertThat(uniqueKeyField, is(not(nullValue())));+ assertThat(uniqueKeyField, equalTo(schema.getUniqueKeyField()));+ assertThat(schema.getRequiredFields(), hasItem(schema.getUniqueKeyField()));+ assertThat(factory.canCreateTombstoneDocument(schema), is(true));}private void updateWithChain(String chain, String... fields) throws Exception {diff --git a/solr/core/src/test/org/apache/solr/util/TestCircuitBreakers.java b/solr/core/src/test/org/apache/solr/util/TestCircuitBreakers.javaindex aebc5483a15..d8cb3c9d17e 100644--- a/solr/core/src/test/org/apache/solr/util/TestCircuitBreakers.java+++ b/solr/core/src/test/org/apache/solr/util/TestCircuitBreakers.java@@ -37,7 +37,6 @@ import org.apache.solr.util.circuitbreaker.CircuitBreaker;import org.apache.solr.util.circuitbreaker.CircuitBreakerRegistry;import org.apache.solr.util.circuitbreaker.LoadAverageCircuitBreaker;import org.apache.solr.util.circuitbreaker.MemoryCircuitBreaker;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.BeforeClass;import org.slf4j.Logger;@@ -230,8 +229,7 @@ public class TestCircuitBreakers extends SolrTestCaseJ4 {try {h.query(req("name:\"john smith\""));} catch (SolrException e) {- MatcherAssert.assertThat(- e.getMessage(), containsString("Circuit Breakers tripped"));+ assertThat(e.getMessage(), containsString("Circuit Breakers tripped"));failureCount.incrementAndGet();} catch (Exception e) {throw new RuntimeException(e.getMessage());diff --git a/solr/core/src/test/org/apache/solr/util/configuration/SSLConfigurationsTest.java b/solr/core/src/test/org/apache/solr/util/configuration/SSLConfigurationsTest.javaindex 42110c2aec5..34bcd69f50e 100644--- a/solr/core/src/test/org/apache/solr/util/configuration/SSLConfigurationsTest.java+++ b/solr/core/src/test/org/apache/solr/util/configuration/SSLConfigurationsTest.java@@ -26,7 +26,6 @@ import org.apache.lucene.tests.util.TestRuleRestoreSystemProperties;import org.apache.solr.SolrTestCase;import org.apache.solr.util.configuration.providers.EnvSSLCredentialProvider;import org.apache.solr.util.configuration.providers.SysPropSSLCredentialProvider;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.Rule;import org.junit.Test;@@ -75,14 +74,14 @@ public class SSLConfigurationsTest extends SolrTestCase {public void testSslConfigKeystorePwFromKeystoreEnvVar() {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_KEY_STORE_PASSWORD, SAMPLE_PW1);createSut().init();- MatcherAssert.assertThat(System.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW1));+ assertThat(System.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW1));}@Testpublic void testSslConfigKeystorePwFromClientKeystoreEnvVar() {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_CLIENT_KEY_STORE_PASSWORD, SAMPLE_PW2);createSut().init();- MatcherAssert.assertThat(System.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW2));+ assertThat(System.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW2));}@Test@@ -90,7 +89,7 @@ public class SSLConfigurationsTest extends SolrTestCase {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_KEY_STORE_PASSWORD, SAMPLE_PW1);envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_CLIENT_KEY_STORE_PASSWORD, SAMPLE_PW2);createSut().init();- MatcherAssert.assertThat(System.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW2));+ assertThat(System.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW2));}@Test@@ -99,22 +98,21 @@ public class SSLConfigurationsTest extends SolrTestCase {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_KEY_STORE_PASSWORD, SAMPLE_PW1);envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_CLIENT_KEY_STORE_PASSWORD, SAMPLE_PW2);createSut().init();- MatcherAssert.assertThat(- System.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW3)); // unchanged+ assertThat(System.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW3)); // unchanged}@Testpublic void testSslConfigTruststorePwFromKeystoreEnvVar() {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_TRUST_STORE_PASSWORD, SAMPLE_PW1);createSut().init();- MatcherAssert.assertThat(System.getProperty(CLIENT_TRUST_STORE_PASSWORD), is(SAMPLE_PW1));+ assertThat(System.getProperty(CLIENT_TRUST_STORE_PASSWORD), is(SAMPLE_PW1));}@Testpublic void testSslConfigTruststorePwFromClientKeystoreEnvVar() {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD, SAMPLE_PW2);createSut().init();- MatcherAssert.assertThat(System.getProperty(CLIENT_TRUST_STORE_PASSWORD), is(SAMPLE_PW2));+ assertThat(System.getProperty(CLIENT_TRUST_STORE_PASSWORD), is(SAMPLE_PW2));}@Test@@ -122,7 +120,7 @@ public class SSLConfigurationsTest extends SolrTestCase {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_TRUST_STORE_PASSWORD, SAMPLE_PW1);envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD, SAMPLE_PW2);createSut().init();- MatcherAssert.assertThat(System.getProperty(CLIENT_TRUST_STORE_PASSWORD), is(SAMPLE_PW2));+ assertThat(System.getProperty(CLIENT_TRUST_STORE_PASSWORD), is(SAMPLE_PW2));}@Test@@ -131,63 +129,62 @@ public class SSLConfigurationsTest extends SolrTestCase {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_TRUST_STORE_PASSWORD, SAMPLE_PW1);envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD, SAMPLE_PW2);createSut().init();- MatcherAssert.assertThat(- System.getProperty(CLIENT_TRUST_STORE_PASSWORD), is(SAMPLE_PW3)); // unchanged+ assertThat(System.getProperty(CLIENT_TRUST_STORE_PASSWORD), is(SAMPLE_PW3)); // unchanged}@Testpublic void testGetKeyStorePasswordFromProperty() {System.setProperty(KEY_STORE_PASSWORD, SAMPLE_PW1);- MatcherAssert.assertThat(createSut().getKeyStorePassword(), is(SAMPLE_PW1));+ assertThat(createSut().getKeyStorePassword(), is(SAMPLE_PW1));}@Testpublic void testGetKeyStorePasswordFromEnv() {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_KEY_STORE_PASSWORD, SAMPLE_PW2);- MatcherAssert.assertThat(createSut().getKeyStorePassword(), is(SAMPLE_PW2));+ assertThat(createSut().getKeyStorePassword(), is(SAMPLE_PW2));}@Testpublic void testGetTrustStorePasswordFromProperty() {System.setProperty(TRUST_STORE_PASSWORD, SAMPLE_PW1);- MatcherAssert.assertThat(createSut().getTrustStorePassword(), is(SAMPLE_PW1));+ assertThat(createSut().getTrustStorePassword(), is(SAMPLE_PW1));}@Testpublic void testGetTrustStorePasswordFromEnv() {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_TRUST_STORE_PASSWORD, SAMPLE_PW2);- MatcherAssert.assertThat(createSut().getTrustStorePassword(), is(SAMPLE_PW2));+ assertThat(createSut().getTrustStorePassword(), is(SAMPLE_PW2));}@Testpublic void testGetClientKeyStorePasswordFromProperty() {System.setProperty(CLIENT_KEY_STORE_PASSWORD, SAMPLE_PW1);- MatcherAssert.assertThat(createSut().getClientKeyStorePassword(), is(SAMPLE_PW1));+ assertThat(createSut().getClientKeyStorePassword(), is(SAMPLE_PW1));}@Testpublic void testGetClientKeyStorePasswordFromEnv() {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_CLIENT_KEY_STORE_PASSWORD, SAMPLE_PW2);- MatcherAssert.assertThat(createSut().getClientKeyStorePassword(), is(SAMPLE_PW2));+ assertThat(createSut().getClientKeyStorePassword(), is(SAMPLE_PW2));}@Testpublic void testGetClientTrustStorePasswordFromProperty() {System.setProperty(CLIENT_TRUST_STORE_PASSWORD, SAMPLE_PW1);- MatcherAssert.assertThat(createSut().getClientTrustStorePassword(), is(SAMPLE_PW1));+ assertThat(createSut().getClientTrustStorePassword(), is(SAMPLE_PW1));}@Testpublic void testGetClientTrustStorePasswordFromEnv() {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD, SAMPLE_PW2);- MatcherAssert.assertThat(createSut().getClientTrustStorePassword(), is(SAMPLE_PW2));+ assertThat(createSut().getClientTrustStorePassword(), is(SAMPLE_PW2));}@Testpublic void testSystemPropertyPriorityOverEnvVar() {envs.put(EnvSSLCredentialProvider.EnvVars.SOLR_SSL_KEY_STORE_PASSWORD, SAMPLE_PW2);- MatcherAssert.assertThat(createSut().getKeyStorePassword(), is(SAMPLE_PW2));+ assertThat(createSut().getKeyStorePassword(), is(SAMPLE_PW2));System.setProperty(KEY_STORE_PASSWORD, SAMPLE_PW1);- MatcherAssert.assertThat(createSut().getKeyStorePassword(), is(SAMPLE_PW2));+ assertThat(createSut().getKeyStorePassword(), is(SAMPLE_PW2));}}diff --git a/solr/core/src/test/org/apache/solr/util/configuration/SSLCredentialProviderFactoryTest.java b/solr/core/src/test/org/apache/solr/util/configuration/SSLCredentialProviderFactoryTest.javaindex 43fa4e88000..e23db5b39a9 100644--- a/solr/core/src/test/org/apache/solr/util/configuration/SSLCredentialProviderFactoryTest.java+++ b/solr/core/src/test/org/apache/solr/util/configuration/SSLCredentialProviderFactoryTest.java@@ -26,7 +26,6 @@ import org.apache.solr.SolrTestCase;import org.apache.solr.util.configuration.providers.EnvSSLCredentialProvider;import org.apache.solr.util.configuration.providers.SysPropSSLCredentialProvider;import org.hamcrest.Matcher;-import org.hamcrest.MatcherAssert;import org.junit.Rule;import org.junit.Test;import org.junit.rules.TestRule;@@ -47,13 +46,13 @@ public class SSLCredentialProviderFactoryTest extends SolrTestCase {public void testGetProvidersOrder() {SSLCredentialProviderFactory sut = getSut("sysprop;env");List<SSLCredentialProvider> providers = sut.getProviders();- MatcherAssert.assertThat(providers.get(0), isA(SysPropSSLCredentialProvider.class));- MatcherAssert.assertThat(providers.get(1), isA(EnvSSLCredentialProvider.class));+ assertThat(providers.get(0), isA(SysPropSSLCredentialProvider.class));+ assertThat(providers.get(1), isA(EnvSSLCredentialProvider.class));sut = getSut("env;sysprop");providers = sut.getProviders();- MatcherAssert.assertThat(providers.get(0), isA(EnvSSLCredentialProvider.class));- MatcherAssert.assertThat(providers.get(1), isA(SysPropSSLCredentialProvider.class));+ assertThat(providers.get(0), isA(EnvSSLCredentialProvider.class));+ assertThat(providers.get(1), isA(SysPropSSLCredentialProvider.class));}@Test@@ -61,9 +60,9 @@ public class SSLCredentialProviderFactoryTest extends SolrTestCase {SSLCredentialProviderFactory sut =getSut("sysprop;class://" + CustomSSLCredentialProvider.class.getName() + ";env");List<SSLCredentialProvider> providers = sut.getProviders();- MatcherAssert.assertThat(providers.get(0), isA(SysPropSSLCredentialProvider.class));- MatcherAssert.assertThat(providers.get(1), isA(CustomSSLCredentialProvider.class));- MatcherAssert.assertThat(providers.get(2), isA(EnvSSLCredentialProvider.class));+ assertThat(providers.get(0), isA(SysPropSSLCredentialProvider.class));+ assertThat(providers.get(1), isA(CustomSSLCredentialProvider.class));+ assertThat(providers.get(2), isA(EnvSSLCredentialProvider.class));}@Test(expected = RuntimeException.class)@@ -77,9 +76,9 @@ public class SSLCredentialProviderFactoryTest extends SolrTestCase {System.setProperty(SSLCredentialProviderFactory.PROVIDER_CHAIN_KEY, chain);SSLCredentialProviderFactory sut = new SSLCredentialProviderFactory();List<SSLCredentialProvider> providers = sut.getProviders();- MatcherAssert.assertThat(providers.get(0), isA(SysPropSSLCredentialProvider.class));- MatcherAssert.assertThat(providers.get(1), isA(CustomSSLCredentialProvider.class));- MatcherAssert.assertThat(providers.get(2), isA(EnvSSLCredentialProvider.class));+ assertThat(providers.get(0), isA(SysPropSSLCredentialProvider.class));+ assertThat(providers.get(1), isA(CustomSSLCredentialProvider.class));+ assertThat(providers.get(2), isA(EnvSSLCredentialProvider.class));}private SSLCredentialProviderFactory getSut(String providerChain) {diff --git a/solr/core/src/test/org/apache/solr/util/configuration/providers/EnvSSLCredentialProviderTest.java b/solr/core/src/test/org/apache/solr/util/configuration/providers/EnvSSLCredentialProviderTest.javaindex e0bd1452cd2..931e9d7ae78 100644--- a/solr/core/src/test/org/apache/solr/util/configuration/providers/EnvSSLCredentialProviderTest.java+++ b/solr/core/src/test/org/apache/solr/util/configuration/providers/EnvSSLCredentialProviderTest.java@@ -23,7 +23,6 @@ import static org.hamcrest.core.Is.is;import java.util.Map;import org.apache.solr.SolrTestCase;import org.apache.solr.util.configuration.SSLCredentialProvider;-import org.hamcrest.MatcherAssert;import org.junit.Test;/** */@@ -44,7 +43,7 @@ public class EnvSSLCredentialProviderTest extends SolrTestCase {for (Map.Entry<SSLCredentialProvider.CredentialType, String> set :DEFAULT_CREDENTIAL_KEY_MAP.entrySet()) {String expectedpw = "pw" + ++cnt;- MatcherAssert.assertThat(sut.getCredential(set.getKey()), is(expectedpw));+ assertThat(sut.getCredential(set.getKey()), is(expectedpw));}}diff --git a/solr/core/src/test/org/apache/solr/util/configuration/providers/SysPropSSLCredentialProviderTest.java b/solr/core/src/test/org/apache/solr/util/configuration/providers/SysPropSSLCredentialProviderTest.javaindex 1bcc4ee6c6a..0235d8802d0 100644--- a/solr/core/src/test/org/apache/solr/util/configuration/providers/SysPropSSLCredentialProviderTest.java+++ b/solr/core/src/test/org/apache/solr/util/configuration/providers/SysPropSSLCredentialProviderTest.java@@ -25,7 +25,6 @@ import org.apache.lucene.tests.util.TestRuleRestoreSystemProperties;import org.apache.solr.SolrTestCase;import org.apache.solr.util.configuration.SSLConfigurations;import org.apache.solr.util.configuration.SSLCredentialProvider;-import org.hamcrest.MatcherAssert;import org.junit.Rule;import org.junit.Test;import org.junit.rules.TestRule;@@ -49,7 +48,7 @@ public class SysPropSSLCredentialProviderTest extends SolrTestCase {DEFAULT_CREDENTIAL_KEY_MAP.entrySet()) {String pw = "pw" + ++cnt;System.setProperty(set.getValue(), pw);- MatcherAssert.assertThat(sut.getCredential(set.getKey()), is(pw));+ assertThat(sut.getCredential(set.getKey()), is(pw));}}diff --git a/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentTest.java b/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentTest.javaindex ceaecb04be2..32422d78c3d 100644--- a/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentTest.java+++ b/solr/modules/clustering/src/test/org/apache/solr/handler/clustering/ClusteringComponentTest.java@@ -45,7 +45,6 @@ import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.response.ResultContext;import org.apache.solr.response.SolrQueryResponse;import org.carrot2.clustering.Cluster;-import org.hamcrest.MatcherAssert;import org.hamcrest.Matchers;import org.junit.BeforeClass;import org.junit.Test;@@ -167,7 +166,7 @@ public class ClusteringComponentTest extends SolrTestCaseJ4 {List<String> labels2 = full.get(i).getLabels();assertEquals(labels1.size(), labels2.size());for (int j = 0; j < labels1.size(); j++) {- MatcherAssert.assertThat(+ assertThat("Summary shorter than original document?",labels1.get(j).length(),Matchers.lessThanOrEqualTo(labels2.get(j).length()));@@ -214,7 +213,7 @@ public class ClusteringComponentTest extends SolrTestCaseJ4 {List<String> longLabels = longSummaries.get(i).getLabels();assertEquals(shortLabels.size(), longLabels.size());for (int j = 0; j < shortLabels.size(); j++) {- MatcherAssert.assertThat(+ assertThat("Shorter summary is longer than longer summary?",shortLabels.get(j).length(),Matchers.lessThanOrEqualTo(longLabels.get(j).length()));@@ -257,7 +256,7 @@ public class ClusteringComponentTest extends SolrTestCaseJ4 {clusters.forEach(c -> {- MatcherAssert.assertThat(c.getLabels(), Matchers.hasSize(3));+ assertThat(c.getLabels(), Matchers.hasSize(3));});}diff --git a/solr/modules/hadoop-auth/src/test/org/apache/solr/util/configuration/HadoopSSLConfigurationsTest.java b/solr/modules/hadoop-auth/src/test/org/apache/solr/util/configuration/HadoopSSLConfigurationsTest.javaindex 72090ebc42e..b29c5444a9a 100644--- a/solr/modules/hadoop-auth/src/test/org/apache/solr/util/configuration/HadoopSSLConfigurationsTest.java+++ b/solr/modules/hadoop-auth/src/test/org/apache/solr/util/configuration/HadoopSSLConfigurationsTest.java@@ -32,7 +32,6 @@ import org.apache.solr.common.util.EnvUtils;import org.apache.solr.util.configuration.providers.EnvSSLCredentialProvider;import org.apache.solr.util.configuration.providers.SysPropSSLCredentialProvider;import org.apache.solr.util.configuration.providers.hadoop.HadoopSSLCredentialProvider;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.Rule;import org.junit.Test;@@ -81,7 +80,7 @@ public class HadoopSSLConfigurationsTest extends SolrTestCaseJ4 {getSutWithMockedHadoopCredentialProvider(SSLConfigurations.SysProps.SSL_KEY_STORE_PASSWORD, SAMPLE_PW1).init();- MatcherAssert.assertThat(EnvUtils.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW1));+ assertThat(EnvUtils.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW1));}@Test@@ -90,7 +89,7 @@ public class HadoopSSLConfigurationsTest extends SolrTestCaseJ4 {getSutWithMockedHadoopCredentialProvider(SSLConfigurations.SysProps.SSL_CLIENT_KEY_STORE_PASSWORD, SAMPLE_PW2).init();- MatcherAssert.assertThat(EnvUtils.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW2));+ assertThat(EnvUtils.getProperty(CLIENT_KEY_STORE_PASSWORD), is(SAMPLE_PW2));}@Test@@ -98,7 +97,7 @@ public class HadoopSSLConfigurationsTest extends SolrTestCaseJ4 {SSLConfigurations sut =getSutWithMockedHadoopCredentialProvider(SSLConfigurations.SysProps.SSL_KEY_STORE_PASSWORD, SAMPLE_PW3);- MatcherAssert.assertThat(sut.getKeyStorePassword(), is(SAMPLE_PW3));+ assertThat(sut.getKeyStorePassword(), is(SAMPLE_PW3));}@Test@@ -106,7 +105,7 @@ public class HadoopSSLConfigurationsTest extends SolrTestCaseJ4 {SSLConfigurations sut =getSutWithMockedHadoopCredentialProvider(SSLConfigurations.SysProps.SSL_TRUST_STORE_PASSWORD, SAMPLE_PW3);- MatcherAssert.assertThat(sut.getTrustStorePassword(), is(SAMPLE_PW3));+ assertThat(sut.getTrustStorePassword(), is(SAMPLE_PW3));}@Test@@ -114,7 +113,7 @@ public class HadoopSSLConfigurationsTest extends SolrTestCaseJ4 {SSLConfigurations sut =getSutWithMockedHadoopCredentialProvider(SSLConfigurations.SysProps.SSL_CLIENT_KEY_STORE_PASSWORD, SAMPLE_PW3);- MatcherAssert.assertThat(sut.getClientKeyStorePassword(), is(SAMPLE_PW3));+ assertThat(sut.getClientKeyStorePassword(), is(SAMPLE_PW3));}@Test@@ -122,14 +121,14 @@ public class HadoopSSLConfigurationsTest extends SolrTestCaseJ4 {SSLConfigurations sut =getSutWithMockedHadoopCredentialProvider(SSLConfigurations.SysProps.SSL_CLIENT_TRUST_STORE_PASSWORD, SAMPLE_PW3);- MatcherAssert.assertThat(sut.getClientTrustStorePassword(), is(SAMPLE_PW3));+ assertThat(sut.getClientTrustStorePassword(), is(SAMPLE_PW3));}@Testpublic void testHadoopCredentialProviderPrioritySysPropAndEnvVars() throws IOException {SSLConfigurations sut =getSutWithMockedHadoopCredentialProvider(KEY_STORE_PASSWORD, SAMPLE_PW3);- MatcherAssert.assertThat(sut.getKeyStorePassword(), is(SAMPLE_PW3));+ assertThat(sut.getKeyStorePassword(), is(SAMPLE_PW3));}private SSLConfigurations getSutWithMockedHadoopCredentialProvider(String key, String pw)diff --git a/solr/modules/hadoop-auth/src/test/org/apache/solr/util/configuration/providers/hadoop/HadoopSSLCredentialProviderTest.java b/solr/modules/hadoop-auth/src/test/org/apache/solr/util/configuration/providers/hadoop/HadoopSSLCredentialProviderTest.javaindex a304f106439..8a40deeaa31 100644--- a/solr/modules/hadoop-auth/src/test/org/apache/solr/util/configuration/providers/hadoop/HadoopSSLCredentialProviderTest.java+++ b/solr/modules/hadoop-auth/src/test/org/apache/solr/util/configuration/providers/hadoop/HadoopSSLCredentialProviderTest.java@@ -27,7 +27,6 @@ import org.apache.hadoop.conf.Configuration;import org.apache.lucene.tests.util.TestRuleRestoreSystemProperties;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.util.configuration.SSLCredentialProvider;-import org.hamcrest.MatcherAssert;import org.junit.Rule;import org.junit.Test;import org.junit.rules.TestRule;@@ -52,7 +51,7 @@ public class HadoopSSLCredentialProviderTest extends SolrTestCaseJ4 {String pw = "pw" + ++cnt;HadoopSSLCredentialProvider sut =new HadoopSSLCredentialProvider(getMockedHadoopCredentialProvider(set.getValue(), pw));- MatcherAssert.assertThat(sut.getCredential(set.getKey()), is(pw));+ assertThat(sut.getCredential(set.getKey()), is(pw));}}diff --git a/solr/modules/ltr/src/test/org/apache/solr/ltr/interleaving/algorithms/TestTeamDraftInterleaving.java b/solr/modules/ltr/src/test/org/apache/solr/ltr/interleaving/algorithms/TestTeamDraftInterleaving.javaindex ae847df6626..811fc51cb4f 100644--- a/solr/modules/ltr/src/test/org/apache/solr/ltr/interleaving/algorithms/TestTeamDraftInterleaving.java+++ b/solr/modules/ltr/src/test/org/apache/solr/ltr/interleaving/algorithms/TestTeamDraftInterleaving.java@@ -25,7 +25,6 @@ import java.util.Set;import org.apache.lucene.search.ScoreDoc;import org.apache.solr.SolrTestCase;import org.apache.solr.ltr.interleaving.InterleavingResult;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.Test;@@ -66,15 +65,15 @@ public class TestTeamDraftInterleaving extends SolrTestCase {InterleavingResult interleaved = toTest.interleave(rerankedA, rerankedB);ScoreDoc[] interleavedResults = interleaved.getInterleavedResults();- MatcherAssert.assertThat(interleavedResults.length, is(5));+ assertThat(interleavedResults.length, is(5));- MatcherAssert.assertThat(interleavedResults[0], is(a1));- MatcherAssert.assertThat(interleavedResults[1], is(b2));+ assertThat(interleavedResults[0], is(a1));+ assertThat(interleavedResults[1], is(b2));- MatcherAssert.assertThat(interleavedResults[2], is(b3));- MatcherAssert.assertThat(interleavedResults[3], is(a4));+ assertThat(interleavedResults[2], is(b3));+ assertThat(interleavedResults[3], is(a4));- MatcherAssert.assertThat(interleavedResults[4], is(b4));+ assertThat(interleavedResults[4], is(b4));}/** Random Boolean Choices Generation from Seed: [0,1,1] */@@ -88,8 +87,8 @@ public class TestTeamDraftInterleaving extends SolrTestCase {Set<Integer> modelAPicks = interleavingPicks.get(0);Set<Integer> modelBPicks = interleavingPicks.get(1);- MatcherAssert.assertThat(modelAPicks.size(), is(2));- MatcherAssert.assertThat(modelBPicks.size(), is(3));+ assertThat(modelAPicks.size(), is(2));+ assertThat(modelBPicks.size(), is(3));assertTrue(modelAPicks.contains(a1.doc));assertTrue(modelAPicks.contains(a4.doc));@@ -123,15 +122,15 @@ public class TestTeamDraftInterleaving extends SolrTestCase {InterleavingResult interleaved = toTest.interleave(rerankedA, rerankedB);ScoreDoc[] interleavedResults = interleaved.getInterleavedResults();- MatcherAssert.assertThat(interleavedResults.length, is(5));+ assertThat(interleavedResults.length, is(5));- MatcherAssert.assertThat(interleavedResults[0], is(a1));- MatcherAssert.assertThat(interleavedResults[1], is(b2));+ assertThat(interleavedResults[0], is(a1));+ assertThat(interleavedResults[1], is(b2));- MatcherAssert.assertThat(interleavedResults[2], is(b3));- MatcherAssert.assertThat(interleavedResults[3], is(a4));+ assertThat(interleavedResults[2], is(b3));+ assertThat(interleavedResults[3], is(a4));- MatcherAssert.assertThat(interleavedResults[4], is(b5));+ assertThat(interleavedResults[4], is(b5));}/** Random Boolean Choices Generation from Seed: [0,1,1] */@@ -145,8 +144,8 @@ public class TestTeamDraftInterleaving extends SolrTestCase {Set<Integer> modelAPicks = interleavingPicks.get(0);Set<Integer> modelBPicks = interleavingPicks.get(1);- MatcherAssert.assertThat(modelAPicks.size(), is(2));- MatcherAssert.assertThat(modelBPicks.size(), is(3));+ assertThat(modelAPicks.size(), is(2));+ assertThat(modelBPicks.size(), is(3));assertTrue(modelAPicks.contains(a1.doc));assertTrue(modelAPicks.contains(a4.doc));diff --git a/solr/modules/ltr/src/test/org/apache/solr/ltr/model/TestMultipleAdditiveTreesModel.java b/solr/modules/ltr/src/test/org/apache/solr/ltr/model/TestMultipleAdditiveTreesModel.javaindex 1995b5fb7db..8b91d68011b 100644--- a/solr/modules/ltr/src/test/org/apache/solr/ltr/model/TestMultipleAdditiveTreesModel.java+++ b/solr/modules/ltr/src/test/org/apache/solr/ltr/model/TestMultipleAdditiveTreesModel.java@@ -20,7 +20,6 @@ import static org.hamcrest.core.StringContains.containsString;import org.apache.solr.client.solrj.SolrQuery;import org.apache.solr.ltr.TestRerankBase;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.Before;import org.junit.Test;@@ -100,24 +99,23 @@ public class TestMultipleAdditiveTreesModel extends TestRerankBase {String qryResult = JQ("/query" + query.toQueryString());qryResult = qryResult.replace("\n", " ");- MatcherAssert.assertThat(qryResult, containsString("\"debug\":{"));+ assertThat(qryResult, containsString("\"debug\":{"));qryResult = qryResult.substring(qryResult.indexOf("debug"));- MatcherAssert.assertThat(qryResult, containsString("\"explain\":{"));+ assertThat(qryResult, containsString("\"explain\":{"));qryResult = qryResult.substring(qryResult.indexOf("explain"));- MatcherAssert.assertThat(qryResult, containsString("multipleadditivetreesmodel"));- MatcherAssert.assertThat(- qryResult, containsString(MultipleAdditiveTreesModel.class.getSimpleName()));+ assertThat(qryResult, containsString("multipleadditivetreesmodel"));+ assertThat(qryResult, containsString(MultipleAdditiveTreesModel.class.getSimpleName()));- MatcherAssert.assertThat(qryResult, containsString("-100.0 = tree 0"));- MatcherAssert.assertThat(qryResult, containsString("50.0 = tree 0"));- MatcherAssert.assertThat(qryResult, containsString("-20.0 = tree 1"));- MatcherAssert.assertThat(qryResult, containsString("'matchedTitle':1.0 > 0.5"));- MatcherAssert.assertThat(qryResult, containsString("'matchedTitle':0.0 <= 0.5"));+ assertThat(qryResult, containsString("-100.0 = tree 0"));+ assertThat(qryResult, containsString("50.0 = tree 0"));+ assertThat(qryResult, containsString("-20.0 = tree 1"));+ assertThat(qryResult, containsString("'matchedTitle':1.0 > 0.5"));+ assertThat(qryResult, containsString("'matchedTitle':0.0 <= 0.5"));- MatcherAssert.assertThat(qryResult, containsString(" Go Right "));- MatcherAssert.assertThat(qryResult, containsString(" Go Left "));+ assertThat(qryResult, containsString(" Go Right "));+ assertThat(qryResult, containsString(" Go Left "));}@Test@@ -336,25 +334,24 @@ public class TestMultipleAdditiveTreesModel extends TestRerankBase {String qryResult = JQ("/query" + query.toQueryString());qryResult = qryResult.replace("\n", " ");- MatcherAssert.assertThat(qryResult, containsString("\"debug\":{"));+ assertThat(qryResult, containsString("\"debug\":{"));qryResult = qryResult.substring(qryResult.indexOf("debug"));- MatcherAssert.assertThat(qryResult, containsString("\"explain\":{"));+ assertThat(qryResult, containsString("\"explain\":{"));qryResult = qryResult.substring(qryResult.indexOf("explain"));- MatcherAssert.assertThat(qryResult, containsString("modelA"));- MatcherAssert.assertThat(- qryResult, containsString(MultipleAdditiveTreesModel.class.getSimpleName()));+ assertThat(qryResult, containsString("modelA"));+ assertThat(qryResult, containsString(MultipleAdditiveTreesModel.class.getSimpleName()));- MatcherAssert.assertThat(qryResult, containsString("50.0 = tree 0"));- MatcherAssert.assertThat(qryResult, containsString("-20.0 = tree 1"));- MatcherAssert.assertThat(qryResult, containsString("'matchedTitle':1.0 > 0.5"));- MatcherAssert.assertThat(+ assertThat(qryResult, containsString("50.0 = tree 0"));+ assertThat(qryResult, containsString("-20.0 = tree 1"));+ assertThat(qryResult, containsString("'matchedTitle':1.0 > 0.5"));+ assertThat(qryResult,containsString("'constantScoreToForceMultipleAdditiveTreesScoreAllDocs':1.0 <= 10.0"));- MatcherAssert.assertThat(qryResult, containsString("'userDevice': NaN"));+ assertThat(qryResult, containsString("'userDevice': NaN"));- MatcherAssert.assertThat(qryResult, containsString(" Go Right "));- MatcherAssert.assertThat(qryResult, containsString(" Go Left "));+ assertThat(qryResult, containsString(" Go Right "));+ assertThat(qryResult, containsString(" Go Left "));}}diff --git a/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3ReadWriteTest.java b/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3ReadWriteTest.javaindex 9b6e3172f86..ccfad11a7f2 100644--- a/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3ReadWriteTest.java+++ b/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3ReadWriteTest.java@@ -20,7 +20,6 @@ import static org.hamcrest.Matchers.containsString;import java.io.InputStream;import java.nio.charset.StandardCharsets;-import org.hamcrest.MatcherAssert;import org.junit.Test;/** Basic test that write data and read them through the S3 client. */@@ -93,8 +92,7 @@ public class S3ReadWriteTest extends AbstractS3ClientTest {"Getting length on a dir should throw exception",S3Exception.class,() -> client.length("/directory"));- MatcherAssert.assertThat(- exception.getMessage(), exception.getMessage(), containsString("Path is Directory"));+ assertThat(exception.getMessage(), exception.getMessage(), containsString("Path is Directory"));}/** Check various method throws the expected exception of a missing S3 key. */diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.javaindex f45c94ca73b..bb5f97ac7ab 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java@@ -76,7 +76,6 @@ import org.apache.solr.common.util.ContentStreamBase;import org.apache.solr.common.util.NamedList;import org.apache.solr.common.util.Pair;import org.apache.solr.util.RTimer;-import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.Test;import org.noggit.JSONParser;@@ -720,7 +719,7 @@ public abstract class SolrExampleTests extends SolrExampleTestsBase {query.set(AnalysisParams.FIELD_VALUE, "ignore_exception");SolrException ex = expectThrows(SolrException.class, () -> client.query(query));assertEquals(400, ex.code());- MatcherAssert.assertThat(ex.getMessage(), containsString("Invalid Number: ignore_exception"));+ assertThat(ex.getMessage(), containsString("Invalid Number: ignore_exception"));// the df=text here is a kluge for the test to supply a default field in case there is none in// schema.xml. alternatively, the resulting assertion could be modified to assert that no@@ -3032,9 +3031,9 @@ public abstract class SolrExampleTests extends SolrExampleTestsBase {q.addSort("id", SolrQuery.ORDER.desc);SolrDocumentList results = client.query(q).getResults();- MatcherAssert.assertThat(results.getNumFound(), is(1L));+ assertThat(results.getNumFound(), is(1L));SolrDocument foundDoc = results.get(0);- MatcherAssert.assertThat(foundDoc.getFieldValue("title_s"), is("i am a child free doc"));+ assertThat(foundDoc.getFieldValue("title_s"), is("i am a child free doc"));// Rewrite child free docdocToUpdate.setField("title_s", "i am a parent");@@ -3050,11 +3049,11 @@ public abstract class SolrExampleTests extends SolrExampleTestsBase {results = client.query(q).getResults();- MatcherAssert.assertThat(results.getNumFound(), is(2L));+ assertThat(results.getNumFound(), is(2L));foundDoc = results.get(0);- MatcherAssert.assertThat(foundDoc.getFieldValue("title_s"), is("i am a parent"));+ assertThat(foundDoc.getFieldValue("title_s"), is("i am a parent"));foundDoc = results.get(1);- MatcherAssert.assertThat(foundDoc.getFieldValue("title_s"), is("i am a child"));+ assertThat(foundDoc.getFieldValue("title_s"), is("i am a child"));}@Test@@ -3092,13 +3091,13 @@ public abstract class SolrExampleTests extends SolrExampleTestsBase {SolrQuery q = new SolrQuery("*:*");SolrDocumentList results = client.query(q).getResults();- MatcherAssert.assertThat(results.getNumFound(), is(4L));+ assertThat(results.getNumFound(), is(4L));client.deleteById("p0");client.commit();results = client.query(q).getResults();- MatcherAssert.assertThat(+ assertThat("All the children are expected to be deleted together with parent",results.getNumFound(),is(0L));diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.javaindex 3dc395c2f0b..f0246b53fc8 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java@@ -75,7 +75,6 @@ import org.apache.solr.handler.admin.CollectionsHandler;import org.apache.solr.handler.admin.ConfigSetsHandler;import org.apache.solr.handler.admin.CoreAdminHandler;import org.apache.solr.util.LogLevel;-import org.hamcrest.MatcherAssert;import org.hamcrest.Matchers;import org.junit.AfterClass;import org.junit.BeforeClass;@@ -850,11 +849,11 @@ public class CloudSolrClientTest extends SolrCloudTestCase {ZkClientClusterStateProvider.from(client)) {zkClientClusterStateProvider.setZkConnectTimeout(1000 * 60);SolrException ex = expectThrows(SolrException.class, client::connect);- MatcherAssert.assertThat(+ assertThat("Wrong error message for empty chRoot",ex.getMessage(),Matchers.containsString("cluster not found/not ready"));- MatcherAssert.assertThat(+ assertThat("Wrong node missing message for empty chRoot",ex.getMessage(),Matchers.containsString(diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.javaindex a6a0ab2a7d6..b1be49c24ed 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java@@ -41,7 +41,6 @@ import org.apache.solr.common.SolrInputDocument;import org.apache.solr.common.params.CommonParams;import org.apache.solr.embedded.JettyConfig;import org.eclipse.jetty.servlet.ServletHolder;-import org.hamcrest.MatcherAssert;import org.junit.BeforeClass;public abstract class HttpSolrClientTestBase extends SolrJettyTestBase {@@ -435,7 +434,7 @@ public abstract class HttpSolrClientTestBase extends SolrJettyTestBase {final var rsp = req.process(client);Object stream = rsp.getResponse().get("stream");assertNotNull(stream);- MatcherAssert.assertThat(stream, instanceOf(InputStream.class));+ assertThat(stream, instanceOf(InputStream.class));InputStream is = (InputStream) stream;assertNotNull(is.readAllBytes()); // throws IOException if closedorg.apache.solr.common.util.IOUtils.closeQuietly((InputStream) stream);diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/SendUpdatesToLeadersOverrideTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/SendUpdatesToLeadersOverrideTest.javaindex 12009c6592f..ac70668c09e 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/SendUpdatesToLeadersOverrideTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/SendUpdatesToLeadersOverrideTest.java@@ -41,7 +41,6 @@ import org.apache.solr.common.cloud.Replica;import org.apache.solr.request.SolrQueryRequest;import org.apache.solr.update.UpdateCommand;import org.apache.solr.update.processor.TrackingUpdateProcessorFactory;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.BeforeClass;import org.slf4j.Logger;@@ -194,7 +193,7 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {// post-distrib should never match any PULL replicas, regardless of request, if this fails// something is seriously wrong with our cluster- MatcherAssert.assertThat(+ assertThat("post-distrib should never be PULL replica",results.postDistribCores.keySet(),everyItem(not(isIn(PULL_REPLICA_CORE_NAMES))));@@ -286,10 +285,10 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {assertUpdateWithRecording(new UpdateRequest().add(sdoc("id", "hoss")), client);// single NRT leader is only core that should be involved at all- MatcherAssert.assertThat("add pre-distrib size", add.preDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat("add pre-distrib size", add.preDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("add pre-distrib size", add.preDistribCommands, hasSize(1));- MatcherAssert.assertThat(+ assertThat("add pre-distrib size", add.preDistribCores.keySet(), hasSize(1));+ assertThat("add pre-distrib size", add.preDistribRequests.keySet(), hasSize(1));+ assertThat("add pre-distrib size", add.preDistribCommands, hasSize(1));+ assertThat("add pre-distrib must be leader",add.preDistribCores.keySet(),everyItem(isIn(LEADER_CORE_NAMES)));@@ -314,32 +313,31 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {"add and del should have been routed the same",add.preDistribCores.keySet(),del.preDistribCores.keySet());- MatcherAssert.assertThat("del pre-distrib size", del.preDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("del pre-distrib size", del.preDistribCommands, hasSize(1));+ assertThat("del pre-distrib size", del.preDistribRequests.keySet(), hasSize(1));+ assertThat("del pre-distrib size", del.preDistribCommands, hasSize(1));}{ // DBQ should start on some leader, and then distrib to both leadersfinal RecordingResults record =assertUpdateWithRecording(new UpdateRequest().deleteByQuery("*:*"), client);- MatcherAssert.assertThat("dbq pre-distrib size", record.preDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat(+ assertThat("dbq pre-distrib size", record.preDistribCores.keySet(), hasSize(1));+ assertThat("dbq pre-distrib must be leader",record.preDistribCores.keySet(),everyItem(isIn(LEADER_CORE_NAMES)));- MatcherAssert.assertThat(- "dbq pre-distrib size", record.preDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("dbq pre-distrib size", record.preDistribCommands, hasSize(1));+ assertThat("dbq pre-distrib size", record.preDistribRequests.keySet(), hasSize(1));+ assertThat("dbq pre-distrib size", record.preDistribCommands, hasSize(1));assertEquals("dbq post-distrib must be all leaders",LEADER_CORE_NAMES,record.postDistribCores.keySet());- MatcherAssert.assertThat(+ assertThat("dbq post-distrib size",record.postDistribRequests.keySet(),hasSize(LEADER_CORE_NAMES.size()));- MatcherAssert.assertThat(+ assertThat("dbq post-distrib size", record.postDistribCommands, hasSize(LEADER_CORE_NAMES.size()));}@@ -353,16 +351,15 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {// NOTE: Don't assume our docIds are spread across multi-shards...// ...but the original number of requests should all be diff leaders- MatcherAssert.assertThat(+ assertThat("multi pre-distrib must be leaders",record.preDistribCores.keySet(),everyItem(isIn(LEADER_CORE_NAMES)));- MatcherAssert.assertThat(+ assertThat("multi pre-distrib req != pre-distrib num cores",record.preDistribRequests.keySet(),hasSize(record.preDistribCores.keySet().size()));- MatcherAssert.assertThat(- "multi pre-distrib command size", record.preDistribCommands, hasSize(100 + 10));+ assertThat("multi pre-distrib command size", record.preDistribCommands, hasSize(100 + 10));assertEquals("multi post-distrib must be same leaders",@@ -375,8 +372,7 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {"multi post-distrib cores don't match pre-distrib cores",record.preDistribCores.keySet(),record.postDistribCores.keySet());- MatcherAssert.assertThat(- "multi post-distrib command size", record.postDistribCommands, hasSize(100 + 10));+ assertThat("multi post-distrib command size", record.postDistribCommands, hasSize(100 + 10));}}@@ -395,68 +391,65 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {assertUpdateWithRecording(prefPull(new UpdateRequest().add(sdoc("id", "hoss"))), client);// ...should start on (some) PULL replica, since we asked nicely- MatcherAssert.assertThat("add pre-distrib size", add.preDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat(+ assertThat("add pre-distrib size", add.preDistribCores.keySet(), hasSize(1));+ assertThat("add pre-distrib must be PULL",add.preDistribCores.keySet(),everyItem(isIn(PULL_REPLICA_CORE_NAMES)));- MatcherAssert.assertThat("add pre-distrib size", add.preDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("add pre-distrib size", add.preDistribCommands, hasSize(1));+ assertThat("add pre-distrib size", add.preDistribRequests.keySet(), hasSize(1));+ assertThat("add pre-distrib size", add.preDistribCommands, hasSize(1));// ...then be routed to single leader for this id- MatcherAssert.assertThat("add post-distrib size", add.postDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat(+ assertThat("add post-distrib size", add.postDistribCores.keySet(), hasSize(1));+ assertThat("add post-distrib must be leader",add.postDistribCores.keySet(),everyItem(isIn(LEADER_CORE_NAMES)));- MatcherAssert.assertThat(- "add post-distrib size", add.postDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("add post-distrib size", add.postDistribCommands, hasSize(1));+ assertThat("add post-distrib size", add.postDistribRequests.keySet(), hasSize(1));+ assertThat("add post-distrib size", add.postDistribCommands, hasSize(1));// A DBI should also start on (some) PULL replica, since we asked nicely.//// then it should be distributed to whatever leader our add doc (for the same id) was sent tofinal RecordingResults del =assertUpdateWithRecording(prefPull(new UpdateRequest().deleteById("hoss")), client);- MatcherAssert.assertThat("del pre-distrib size", del.preDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat(+ assertThat("del pre-distrib size", del.preDistribCores.keySet(), hasSize(1));+ assertThat("del pre-distrib must be PULL",del.preDistribCores.keySet(),everyItem(isIn(PULL_REPLICA_CORE_NAMES)));- MatcherAssert.assertThat("del pre-distrib size", del.preDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("del pre-distrib size", del.preDistribCommands, hasSize(1));+ assertThat("del pre-distrib size", del.preDistribRequests.keySet(), hasSize(1));+ assertThat("del pre-distrib size", del.preDistribCommands, hasSize(1));assertEquals("add and del should have same post-distrib leader",add.postDistribCores.keySet(),del.postDistribCores.keySet());- MatcherAssert.assertThat(- "del post-distrib size", del.postDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("del post-distrib size", del.postDistribCommands, hasSize(1));+ assertThat("del post-distrib size", del.postDistribRequests.keySet(), hasSize(1));+ assertThat("del post-distrib size", del.postDistribCommands, hasSize(1));}{ // DBQ start on (some) PULL replica, since we asked nicely, then be routed to all leadersfinal RecordingResults record =assertUpdateWithRecording(prefPull(new UpdateRequest().deleteByQuery("*:*")), client);- MatcherAssert.assertThat("dbq pre-distrib size", record.preDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat(+ assertThat("dbq pre-distrib size", record.preDistribCores.keySet(), hasSize(1));+ assertThat("dbq pre-distrib must be PULL",record.preDistribCores.keySet(),everyItem(isIn(PULL_REPLICA_CORE_NAMES)));- MatcherAssert.assertThat(- "dbq pre-distrib size", record.preDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("dbq pre-distrib size", record.preDistribCommands, hasSize(1));+ assertThat("dbq pre-distrib size", record.preDistribRequests.keySet(), hasSize(1));+ assertThat("dbq pre-distrib size", record.preDistribCommands, hasSize(1));assertEquals("dbq post-distrib must be all leaders",LEADER_CORE_NAMES,record.postDistribCores.keySet());- MatcherAssert.assertThat(+ assertThat("dbq post-distrib size",record.postDistribRequests.keySet(),hasSize(LEADER_CORE_NAMES.size()));- MatcherAssert.assertThat(+ assertThat("dbq post-distrib size", record.postDistribCommands, hasSize(LEADER_CORE_NAMES.size()));}@@ -467,16 +460,13 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {final RecordingResults record =assertUpdateWithRecording(prefPull(createMultiDirectUpdates(100, 10)), client);- MatcherAssert.assertThat(- "multi pre-distrib size", record.preDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat(+ assertThat("multi pre-distrib size", record.preDistribCores.keySet(), hasSize(1));+ assertThat("multi pre-distrib must be PULL",record.preDistribCores.keySet(),everyItem(isIn(PULL_REPLICA_CORE_NAMES)));- MatcherAssert.assertThat(- "multi pre-distrib req size", record.preDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat(- "multi pre-distrib command size", record.preDistribCommands, hasSize(100 + 10));+ assertThat("multi pre-distrib req size", record.preDistribRequests.keySet(), hasSize(1));+ assertThat("multi pre-distrib command size", record.preDistribCommands, hasSize(100 + 10));assertEquals("multi post-distrib must be all leaders",@@ -486,12 +476,11 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {//// We make no asertion about number of post-distrb requests// (distrib proc may batch differently then what we send)- MatcherAssert.assertThat(+ assertThat("multi post-distrib cores",record.postDistribCores.keySet(),everyItem(isIn(LEADER_CORE_NAMES)));- MatcherAssert.assertThat(- "multi post-distrib command size", record.postDistribCommands, hasSize(100 + 10));+ assertThat("multi post-distrib command size", record.postDistribCommands, hasSize(100 + 10));}}@@ -508,23 +497,22 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {client);// ...should start on (some) PULL replica, since we asked nicely- MatcherAssert.assertThat("add pre-distrib size", add.preDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat(+ assertThat("add pre-distrib size", add.preDistribCores.keySet(), hasSize(1));+ assertThat("add pre-distrib must be PULL",add.preDistribCores.keySet(),everyItem(isIn(PULL_REPLICA_CORE_NAMES)));- MatcherAssert.assertThat("add pre-distrib size", add.preDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("add pre-distrib size", add.preDistribCommands, hasSize(1));+ assertThat("add pre-distrib size", add.preDistribRequests.keySet(), hasSize(1));+ assertThat("add pre-distrib size", add.preDistribCommands, hasSize(1));// ...then be routed to single leader for this id- MatcherAssert.assertThat("add post-distrib size", add.postDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat(+ assertThat("add post-distrib size", add.postDistribCores.keySet(), hasSize(1));+ assertThat("add post-distrib must be leader",add.postDistribCores.keySet(),everyItem(isIn(LEADER_CORE_NAMES)));- MatcherAssert.assertThat(- "add post-distrib size", add.postDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("add post-distrib size", add.postDistribCommands, hasSize(1));+ assertThat("add post-distrib size", add.postDistribRequests.keySet(), hasSize(1));+ assertThat("add post-distrib size", add.postDistribCommands, hasSize(1));// A DBI should also start on (some) PULL replica, since we asked nicely.//@@ -532,21 +520,20 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {final RecordingResults del =assertUpdateWithRecording(prefPull(new UpdateRequest().deleteById("hoss")).setSendToLeaders(false), client);- MatcherAssert.assertThat("del pre-distrib size", del.preDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat(+ assertThat("del pre-distrib size", del.preDistribCores.keySet(), hasSize(1));+ assertThat("del pre-distrib must be PULL",del.preDistribCores.keySet(),everyItem(isIn(PULL_REPLICA_CORE_NAMES)));- MatcherAssert.assertThat("del pre-distrib size", del.preDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("del pre-distrib size", del.preDistribCommands, hasSize(1));+ assertThat("del pre-distrib size", del.preDistribRequests.keySet(), hasSize(1));+ assertThat("del pre-distrib size", del.preDistribCommands, hasSize(1));assertEquals("add and del should have same post-distrib leader",add.postDistribCores.keySet(),del.postDistribCores.keySet());- MatcherAssert.assertThat(- "del post-distrib size", del.postDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("del post-distrib size", del.postDistribCommands, hasSize(1));+ assertThat("del post-distrib size", del.postDistribRequests.keySet(), hasSize(1));+ assertThat("del post-distrib size", del.postDistribCommands, hasSize(1));}{ // DBQ start on (some) PULL replica, since we asked nicely, then be routed to all leaders@@ -554,24 +541,23 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {assertUpdateWithRecording(prefPull(new UpdateRequest().deleteByQuery("*:*")).setSendToLeaders(false), client);- MatcherAssert.assertThat("dbq pre-distrib size", record.preDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat(+ assertThat("dbq pre-distrib size", record.preDistribCores.keySet(), hasSize(1));+ assertThat("dbq pre-distrib must be PULL",record.preDistribCores.keySet(),everyItem(isIn(PULL_REPLICA_CORE_NAMES)));- MatcherAssert.assertThat(- "dbq pre-distrib size", record.preDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat("dbq pre-distrib size", record.preDistribCommands, hasSize(1));+ assertThat("dbq pre-distrib size", record.preDistribRequests.keySet(), hasSize(1));+ assertThat("dbq pre-distrib size", record.preDistribCommands, hasSize(1));assertEquals("dbq post-distrib must be all leaders",LEADER_CORE_NAMES,record.postDistribCores.keySet());- MatcherAssert.assertThat(+ assertThat("dbq post-distrib size",record.postDistribRequests.keySet(),hasSize(LEADER_CORE_NAMES.size()));- MatcherAssert.assertThat(+ assertThat("dbq post-distrib size", record.postDistribCommands, hasSize(LEADER_CORE_NAMES.size()));}@@ -583,16 +569,13 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {assertUpdateWithRecording(prefPull(createMultiDirectUpdates(100, 10)).setSendToLeaders(false), client);- MatcherAssert.assertThat(- "multi pre-distrib size", record.preDistribCores.keySet(), hasSize(1));- MatcherAssert.assertThat(+ assertThat("multi pre-distrib size", record.preDistribCores.keySet(), hasSize(1));+ assertThat("multi pre-distrib must be PULL",record.preDistribCores.keySet(),everyItem(isIn(PULL_REPLICA_CORE_NAMES)));- MatcherAssert.assertThat(- "multi pre-distrib req size", record.preDistribRequests.keySet(), hasSize(1));- MatcherAssert.assertThat(- "multi pre-distrib command size", record.preDistribCommands, hasSize(100 + 10));+ assertThat("multi pre-distrib req size", record.preDistribRequests.keySet(), hasSize(1));+ assertThat("multi pre-distrib command size", record.preDistribCommands, hasSize(100 + 10));assertEquals("multi post-distrib must be all leaders",@@ -602,12 +585,11 @@ public class SendUpdatesToLeadersOverrideTest extends SolrCloudTestCase {//// We make no asertion about number of post-distrb requests// (distrib proc may batch differently then what we send)- MatcherAssert.assertThat(+ assertThat("multi post-distrib cores",record.postDistribCores.keySet(),everyItem(isIn(LEADER_CORE_NAMES)));- MatcherAssert.assertThat(- "multi post-distrib command size", record.postDistribCommands, hasSize(100 + 10));+ assertThat("multi post-distrib command size", record.postDistribCommands, hasSize(100 + 10));}}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.javaindex 2be715d469d..bf45abad2f2 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java@@ -45,7 +45,6 @@ import org.apache.solr.common.util.NamedList;import org.apache.solr.common.util.SimpleOrderedMap;import org.apache.solr.util.RestTestBase;import org.eclipse.jetty.servlet.ServletHolder;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.Before;import org.junit.Test;@@ -178,7 +177,7 @@ public class SchemaTest extends RestTestBase {SchemaResponse.FieldsResponse fieldsResponse = fieldsSchemaRequest.process(getSolrClient());assertValidSchemaResponse(fieldsResponse);List<Map<String, Object>> fields = fieldsResponse.getFields();- MatcherAssert.assertThat(fields.isEmpty(), is(false));+ assertThat(fields.isEmpty(), is(false));}@Test@@ -188,8 +187,8 @@ public class SchemaTest extends RestTestBase {SchemaResponse.FieldResponse fieldResponse = fieldSchemaRequest.process(getSolrClient());assertValidSchemaResponse(fieldResponse);Map<String, Object> fieldAttributes = fieldResponse.getField();- MatcherAssert.assertThat(fieldName, is(equalTo(fieldAttributes.get("name"))));- MatcherAssert.assertThat("string", is(equalTo(fieldAttributes.get("type"))));+ assertThat(fieldName, is(equalTo(fieldAttributes.get("name"))));+ assertThat("string", is(equalTo(fieldAttributes.get("type"))));}@Test@@ -199,7 +198,7 @@ public class SchemaTest extends RestTestBase {dynamicFieldsSchemaRequest.process(getSolrClient());assertValidSchemaResponse(dynamicFieldsResponse);List<Map<String, Object>> fields = dynamicFieldsResponse.getDynamicFields();- MatcherAssert.assertThat(fields.isEmpty(), is(false));+ assertThat(fields.isEmpty(), is(false));}@Test@@ -211,8 +210,8 @@ public class SchemaTest extends RestTestBase {dynamicFieldSchemaRequest.process(getSolrClient());assertValidSchemaResponse(dynamicFieldResponse);Map<String, Object> dynamicFieldAttributes = dynamicFieldResponse.getDynamicField();- MatcherAssert.assertThat(dynamicFieldName, is(equalTo(dynamicFieldAttributes.get("name"))));- MatcherAssert.assertThat("int", is(equalTo(dynamicFieldAttributes.get("type"))));+ assertThat(dynamicFieldName, is(equalTo(dynamicFieldAttributes.get("name"))));+ assertThat("int", is(equalTo(dynamicFieldAttributes.get("type"))));}@Test@@ -222,7 +221,7 @@ public class SchemaTest extends RestTestBase {fieldTypesRequest.process(getSolrClient());assertValidSchemaResponse(fieldTypesResponse);List<FieldTypeRepresentation> fieldTypes = fieldTypesResponse.getFieldTypes();- MatcherAssert.assertThat(fieldTypes.isEmpty(), is(false));+ assertThat(fieldTypes.isEmpty(), is(false));}@Test@@ -233,10 +232,8 @@ public class SchemaTest extends RestTestBase {fieldTypeSchemaRequest.process(getSolrClient());assertValidSchemaResponse(fieldTypeResponse);FieldTypeRepresentation fieldTypeDefinition = fieldTypeResponse.getFieldType();- MatcherAssert.assertThat(- fieldType, is(equalTo(fieldTypeDefinition.getAttributes().get("name"))));- MatcherAssert.assertThat(- "solr.StrField", is(equalTo(fieldTypeDefinition.getAttributes().get("class"))));+ assertThat(fieldType, is(equalTo(fieldTypeDefinition.getAttributes().get("name"))));+ assertThat("solr.StrField", is(equalTo(fieldTypeDefinition.getAttributes().get("class"))));}@Test@@ -246,7 +243,7 @@ public class SchemaTest extends RestTestBase {copyFieldsRequest.process(getSolrClient());assertValidSchemaResponse(copyFieldsResponse);List<Map<String, Object>> copyFieldsAttributes = copyFieldsResponse.getCopyFields();- MatcherAssert.assertThat(copyFieldsAttributes.isEmpty(), is(false));+ assertThat(copyFieldsAttributes.isEmpty(), is(false));}@Test@@ -300,12 +297,12 @@ public class SchemaTest extends RestTestBase {SchemaResponse.FieldResponse newFieldResponse = fieldSchemaRequest.process(getSolrClient());assertValidSchemaResponse(newFieldResponse);Map<String, Object> newFieldAttributes = newFieldResponse.getField();- MatcherAssert.assertThat(fieldName, is(equalTo(newFieldAttributes.get("name"))));- MatcherAssert.assertThat("string", is(equalTo(newFieldAttributes.get("type"))));- MatcherAssert.assertThat(false, is(equalTo(newFieldAttributes.get("stored"))));- MatcherAssert.assertThat(true, is(equalTo(newFieldAttributes.get("indexed"))));- MatcherAssert.assertThat("accuracy", is(equalTo(newFieldAttributes.get("default"))));- MatcherAssert.assertThat(true, is(equalTo(newFieldAttributes.get("required"))));+ assertThat(fieldName, is(equalTo(newFieldAttributes.get("name"))));+ assertThat("string", is(equalTo(newFieldAttributes.get("type"))));+ assertThat(false, is(equalTo(newFieldAttributes.get("stored"))));+ assertThat(true, is(equalTo(newFieldAttributes.get("indexed"))));+ assertThat("accuracy", is(equalTo(newFieldAttributes.get("default"))));+ assertThat(true, is(equalTo(newFieldAttributes.get("required"))));}@Test@@ -341,7 +338,7 @@ public class SchemaTest extends RestTestBase {SchemaResponse.FieldResponse initialFieldResponse = fieldSchemaRequest.process(getSolrClient());assertValidSchemaResponse(initialFieldResponse);Map<String, Object> fieldAttributesResponse = initialFieldResponse.getField();- MatcherAssert.assertThat(fieldName, is(equalTo(fieldAttributesResponse.get("name"))));+ assertThat(fieldName, is(equalTo(fieldAttributesResponse.get("name"))));SchemaRequest.DeleteField deleteFieldRequest = new SchemaRequest.DeleteField(fieldName);SchemaResponse.UpdateResponse deleteFieldResponse = deleteFieldRequest.process(getSolrClient());@@ -389,11 +386,11 @@ public class SchemaTest extends RestTestBase {SchemaResponse.FieldResponse newFieldResponse = fieldSchemaRequest.process(getSolrClient());assertValidSchemaResponse(newFieldResponse);Map<String, Object> newFieldAttributes = newFieldResponse.getField();- MatcherAssert.assertThat(fieldName, is(equalTo(newFieldAttributes.get("name"))));- MatcherAssert.assertThat("string", is(equalTo(newFieldAttributes.get("type"))));- MatcherAssert.assertThat(true, is(equalTo(newFieldAttributes.get("stored"))));- MatcherAssert.assertThat(false, is(equalTo(newFieldAttributes.get("indexed"))));- MatcherAssert.assertThat(true, is(equalTo(newFieldAttributes.get("required"))));+ assertThat(fieldName, is(equalTo(newFieldAttributes.get("name"))));+ assertThat("string", is(equalTo(newFieldAttributes.get("type"))));+ assertThat(true, is(equalTo(newFieldAttributes.get("stored"))));+ assertThat(false, is(equalTo(newFieldAttributes.get("indexed"))));+ assertThat(true, is(equalTo(newFieldAttributes.get("required"))));}@Test@@ -427,10 +424,10 @@ public class SchemaTest extends RestTestBase {SchemaResponse.DynamicFieldResponse newFieldResponse = dFieldRequest.process(getSolrClient());assertValidSchemaResponse(newFieldResponse);Map<String, Object> newFieldAttributes = newFieldResponse.getDynamicField();- MatcherAssert.assertThat(dFieldName, is(equalTo(newFieldAttributes.get("name"))));- MatcherAssert.assertThat("string", is(equalTo(newFieldAttributes.get("type"))));- MatcherAssert.assertThat(false, is(equalTo(newFieldAttributes.get("stored"))));- MatcherAssert.assertThat(true, is(equalTo(newFieldAttributes.get("indexed"))));+ assertThat(dFieldName, is(equalTo(newFieldAttributes.get("name"))));+ assertThat("string", is(equalTo(newFieldAttributes.get("type"))));+ assertThat(false, is(equalTo(newFieldAttributes.get("stored"))));+ assertThat(true, is(equalTo(newFieldAttributes.get("indexed"))));}@Test@@ -469,7 +466,7 @@ public class SchemaTest extends RestTestBase {dynamicFieldSchemaRequest.process(getSolrClient());assertValidSchemaResponse(initialDFieldResponse);Map<String, Object> fieldAttributesResponse = initialDFieldResponse.getDynamicField();- MatcherAssert.assertThat(dynamicFieldName, is(equalTo(fieldAttributesResponse.get("name"))));+ assertThat(dynamicFieldName, is(equalTo(fieldAttributesResponse.get("name"))));SchemaRequest.DeleteDynamicField deleteFieldRequest =new SchemaRequest.DeleteDynamicField(dynamicFieldName);@@ -524,10 +521,10 @@ public class SchemaTest extends RestTestBase {dynamicFieldSchemaRequest.process(getSolrClient());assertValidSchemaResponse(newFieldResponse);Map<String, Object> newFieldAttributes = newFieldResponse.getDynamicField();- MatcherAssert.assertThat(fieldName, is(equalTo(newFieldAttributes.get("name"))));- MatcherAssert.assertThat("string", is(equalTo(newFieldAttributes.get("type"))));- MatcherAssert.assertThat(true, is(equalTo(newFieldAttributes.get("stored"))));- MatcherAssert.assertThat(false, is(equalTo(newFieldAttributes.get("indexed"))));+ assertThat(fieldName, is(equalTo(newFieldAttributes.get("name"))));+ assertThat("string", is(equalTo(newFieldAttributes.get("type"))));+ assertThat(true, is(equalTo(newFieldAttributes.get("stored"))));+ assertThat(false, is(equalTo(newFieldAttributes.get("indexed"))));}@Test@@ -596,11 +593,10 @@ public class SchemaTest extends RestTestBase {fieldTypeRequest.process(getSolrClient());assertValidSchemaResponse(newFieldTypeResponse);FieldTypeRepresentation newFieldTypeRepresentation = newFieldTypeResponse.getFieldType();- MatcherAssert.assertThat(- fieldTypeName, is(equalTo(newFieldTypeRepresentation.getAttributes().get("name"))));- MatcherAssert.assertThat(+ assertThat(fieldTypeName, is(equalTo(newFieldTypeRepresentation.getAttributes().get("name"))));+ assertThat("solr.TextField", is(equalTo(newFieldTypeRepresentation.getAttributes().get("class"))));- MatcherAssert.assertThat(+ assertThat(analyzerDefinition.getTokenizer().get("class"),is(equalTo(newFieldTypeRepresentation.getAnalyzer().getTokenizer().get("class"))));}@@ -640,9 +636,8 @@ public class SchemaTest extends RestTestBase {fieldTypeRequest.process(getSolrClient());assertValidSchemaResponse(newFieldTypeResponse);FieldTypeRepresentation newFieldTypeRepresentation = newFieldTypeResponse.getFieldType();- MatcherAssert.assertThat(- fieldTypeName, is(equalTo(newFieldTypeRepresentation.getAttributes().get("name"))));- MatcherAssert.assertThat(+ assertThat(fieldTypeName, is(equalTo(newFieldTypeRepresentation.getAttributes().get("name"))));+ assertThat(similarityAttributes.get("class"),is(equalTo(newFieldTypeRepresentation.getSimilarity().get("class"))));}@@ -674,9 +669,8 @@ public class SchemaTest extends RestTestBase {fieldTypeRequest.process(getSolrClient());assertValidSchemaResponse(newFieldTypeResponse);FieldTypeRepresentation newFieldTypeRepresentation = newFieldTypeResponse.getFieldType();- MatcherAssert.assertThat(- fieldTypeName, is(equalTo(newFieldTypeRepresentation.getAttributes().get("name"))));- MatcherAssert.assertThat(+ assertThat(fieldTypeName, is(equalTo(newFieldTypeRepresentation.getAttributes().get("name"))));+ assertThat(analyzerAttributes.get("class"),is(equalTo(newFieldTypeRepresentation.getAnalyzer().getAttributes().get("class"))));}@@ -724,7 +718,7 @@ public class SchemaTest extends RestTestBase {assertValidSchemaResponse(initialFieldTypeResponse);FieldTypeRepresentation responseFieldTypeRepresentation =initialFieldTypeResponse.getFieldType();- MatcherAssert.assertThat(+ assertThat(fieldTypeName, is(equalTo(responseFieldTypeRepresentation.getAttributes().get("name"))));SchemaRequest.DeleteFieldType deleteFieldTypeRequest =@@ -797,15 +791,14 @@ public class SchemaTest extends RestTestBase {FieldTypeRepresentation replacedFieldTypeRepresentation = newFieldTypeResponse.getFieldType();Map<String, Object> replacedFieldTypeAttributes =replacedFieldTypeRepresentation.getAttributes();- MatcherAssert.assertThat(fieldTypeName, is(equalTo(replacedFieldTypeAttributes.get("name"))));- MatcherAssert.assertThat(+ assertThat(fieldTypeName, is(equalTo(replacedFieldTypeAttributes.get("name"))));+ assertThat(RANDOMIZED_NUMERIC_FIELDTYPES.get(Integer.class),is(equalTo(replacedFieldTypeAttributes.get("class"))));- MatcherAssert.assertThat(false, is(equalTo(replacedFieldTypeAttributes.get("omitNorms"))));- MatcherAssert.assertThat(- "42", is(equalTo(replacedFieldTypeAttributes.get("positionIncrementGap"))));+ assertThat(false, is(equalTo(replacedFieldTypeAttributes.get("omitNorms"))));+ assertThat("42", is(equalTo(replacedFieldTypeAttributes.get("positionIncrementGap"))));// should be unchanged...- MatcherAssert.assertThat(useDv, is(equalTo(replacedFieldTypeAttributes.get("docValues"))));+ assertThat(useDv, is(equalTo(replacedFieldTypeAttributes.get("docValues"))));}@Test@@ -864,7 +857,7 @@ public class SchemaTest extends RestTestBase {if (srcFieldName.equals(currentCopyField.get("source"))) {String currentDestFieldName = (String) currentCopyField.get("dest");int currentMaxChars = (Integer) currentCopyField.get("maxChars");- MatcherAssert.assertThat(+ assertThat(currentDestFieldName, anyOf(is(equalTo(destFieldName1)), is(equalTo(destFieldName2))));assertEquals(maxChars, currentMaxChars);}@@ -951,25 +944,24 @@ public class SchemaTest extends RestTestBase {fieldTypeSchemaRequest.process(getSolrClient());assertValidSchemaResponse(fieldTypeResponse);FieldTypeRepresentation fieldTypeRepresentation = fieldTypeResponse.getFieldType();- MatcherAssert.assertThat(- fieldTypeName, is(equalTo(fieldTypeRepresentation.getAttributes().get("name"))));+ assertThat(fieldTypeName, is(equalTo(fieldTypeRepresentation.getAttributes().get("name"))));SchemaRequest.Field field1SchemaRequest = new SchemaRequest.Field(field1Name);SchemaResponse.FieldResponse field1Response = field1SchemaRequest.process(getSolrClient());assertValidSchemaResponse(field1Response);Map<String, ?> field1Attributes = field1Response.getField();- MatcherAssert.assertThat(field1Name, is(equalTo(field1Attributes.get("name"))));- MatcherAssert.assertThat(fieldTypeName, is(equalTo(field1Attributes.get("type"))));- MatcherAssert.assertThat(true, is(equalTo(field1Attributes.get("stored"))));- MatcherAssert.assertThat(true, is(equalTo(field1Attributes.get("indexed"))));+ assertThat(field1Name, is(equalTo(field1Attributes.get("name"))));+ assertThat(fieldTypeName, is(equalTo(field1Attributes.get("type"))));+ assertThat(true, is(equalTo(field1Attributes.get("stored"))));+ assertThat(true, is(equalTo(field1Attributes.get("indexed"))));SchemaRequest.Field field2SchemaRequest = new SchemaRequest.Field(field1Name);SchemaResponse.FieldResponse field2Response = field2SchemaRequest.process(getSolrClient());assertValidSchemaResponse(field2Response);Map<String, ?> field2Attributes = field2Response.getField();- MatcherAssert.assertThat(field1Name, is(equalTo(field2Attributes.get("name"))));- MatcherAssert.assertThat(fieldTypeName, is(equalTo(field2Attributes.get("type"))));- MatcherAssert.assertThat(true, is(equalTo(field2Attributes.get("stored"))));- MatcherAssert.assertThat(true, is(equalTo(field2Attributes.get("indexed"))));+ assertThat(field1Name, is(equalTo(field2Attributes.get("name"))));+ assertThat(fieldTypeName, is(equalTo(field2Attributes.get("type"))));+ assertThat(true, is(equalTo(field2Attributes.get("stored"))));+ assertThat(true, is(equalTo(field2Attributes.get("indexed"))));}}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.javaindex de7ecfefad9..df1da5fa89c 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java@@ -44,7 +44,6 @@ import org.apache.solr.core.CoreContainer;import org.apache.solr.core.SolrCore;import org.apache.solr.metrics.SolrCoreMetricManager;import org.apache.solr.metrics.SolrMetricManager;-import org.hamcrest.MatcherAssert;import org.junit.Test;public class TestCoreAdmin extends AbstractEmbeddedSolrServerTestCase {@@ -63,10 +62,10 @@ public class TestCoreAdmin extends AbstractEmbeddedSolrServerTestCase {req.setConfigSet("configset-2");CoreAdminResponse response = req.process(client);- MatcherAssert.assertThat((String) response.getResponse().get("core"), is("corewithconfigset"));+ assertThat((String) response.getResponse().get("core"), is("corewithconfigset"));try (SolrCore core = cores.getCore("corewithconfigset")) {- MatcherAssert.assertThat(core, is(notNullValue()));+ assertThat(core, is(notNullValue()));}}diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DomainMapTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DomainMapTest.javaindex 08df0bbbc3b..4cbf7a9cbc5 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DomainMapTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DomainMapTest.java@@ -22,7 +22,6 @@ import static org.hamcrest.core.StringContains.containsString;import java.util.List;import java.util.Map;import org.apache.solr.SolrTestCaseJ4;-import org.hamcrest.MatcherAssert;import org.junit.Test;public class DomainMapTest extends SolrTestCaseJ4 {@@ -35,7 +34,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {() -> {new DomainMap().withFilter(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -67,7 +66,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {() -> {new DomainMap().withQuery(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -99,7 +98,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {() -> {new DomainMap().withTagsToExclude(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -132,7 +131,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {() -> {new DomainMap().setBlockParentQuery(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -149,7 +148,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {() -> {new DomainMap().setBlockChildQuery(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -166,7 +165,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {() -> {new DomainMap().setJoinTransformation(null, "valid-to-field");});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -177,7 +176,7 @@ public class DomainMapTest extends SolrTestCaseJ4 {() -> {new DomainMap().setJoinTransformation("valid-from-field", null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Testdiff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/HeatmapFacetMapTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/HeatmapFacetMapTest.javaindex 67588d50b72..75348ce0a12 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/HeatmapFacetMapTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/HeatmapFacetMapTest.java@@ -20,7 +20,6 @@ package org.apache.solr.client.solrj.request.json;import static org.hamcrest.core.StringContains.containsString;import org.apache.solr.SolrTestCaseJ4;-import org.hamcrest.MatcherAssert;import org.junit.Test;public class HeatmapFacetMapTest extends SolrTestCaseJ4 {@@ -33,7 +32,7 @@ public class HeatmapFacetMapTest extends SolrTestCaseJ4 {() -> {new HeatmapFacetMap(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -51,8 +50,7 @@ public class HeatmapFacetMapTest extends SolrTestCaseJ4 {new HeatmapFacetMap("ANY_FIELD_NAME").withSubFacet("ANY_NAME", new TermsFacetMap("ANY_OTHER_FIELD_NAME"));});- MatcherAssert.assertThat(- thrown.getMessage(), containsString("doesn't currently support subfacets"));+ assertThat(thrown.getMessage(), containsString("doesn't currently support subfacets"));}@Test@@ -63,7 +61,7 @@ public class HeatmapFacetMapTest extends SolrTestCaseJ4 {() -> {new HeatmapFacetMap("ANY_FIELD_NAME").setRegionQuery(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -81,7 +79,7 @@ public class HeatmapFacetMapTest extends SolrTestCaseJ4 {() -> {new HeatmapFacetMap("ANY_FIELD_NAME").setGridLevel(0);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be a positive integer"));+ assertThat(thrown.getMessage(), containsString("must be a positive integer"));}@Test@@ -98,7 +96,7 @@ public class HeatmapFacetMapTest extends SolrTestCaseJ4 {() -> {new HeatmapFacetMap("ANY_FIELD_NAME").setDistErr(-1.0);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-negative"));+ assertThat(thrown.getMessage(), containsString("must be non-negative"));}@Test@@ -115,7 +113,7 @@ public class HeatmapFacetMapTest extends SolrTestCaseJ4 {() -> {new HeatmapFacetMap("ANY_FIELD_NAME").setDistErrPct(2.0);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be between 0.0 and 1.0"));+ assertThat(thrown.getMessage(), containsString("must be between 0.0 and 1.0"));}@Test@@ -132,7 +130,7 @@ public class HeatmapFacetMapTest extends SolrTestCaseJ4 {() -> {new HeatmapFacetMap("ANY_FIELD_NAME").setHeatmapFormat(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Testdiff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/JsonQueryRequestUnitTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/JsonQueryRequestUnitTest.javaindex 92fb2f608b2..6297c56cd6c 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/JsonQueryRequestUnitTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/JsonQueryRequestUnitTest.java@@ -28,7 +28,6 @@ import org.apache.solr.SolrTestCase;import org.apache.solr.client.solrj.request.RequestWriter;import org.apache.solr.client.solrj.util.ClientUtils;import org.apache.solr.common.MapWriter;-import org.hamcrest.MatcherAssert;import org.junit.Test;/** Unit tests for {@link JsonQueryRequest} */@@ -44,7 +43,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().setQuery((String) null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -55,7 +54,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().setQuery((Map<String, Object>) null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -66,14 +65,14 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().setQuery((MapWriter) null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Testpublic void testWritesProvidedQueryStringToJsonCorrectly() {final JsonQueryRequest request = new JsonQueryRequest().setQuery("text:solr");final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(requestBody, containsString("\"query\":\"text:solr\""));+ assertThat(requestBody, containsString("\"query\":\"text:solr\""));}@Test@@ -85,7 +84,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {paramsMap.put("q", "*:*");final JsonQueryRequest request = new JsonQueryRequest().setQuery(queryMap);final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(+ assertThat(requestBody, containsString("\"query\":{\"lucene\":{\"q\":\"*:*\",\"df\":\"text\"}}"));}@@ -106,7 +105,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {};final JsonQueryRequest request = new JsonQueryRequest().setQuery(queryWriter);final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(+ assertThat(requestBody, containsString("\"query\":{\"lucene\":{\"q\":\"*:*\",\"df\":\"text\"}}"));}@@ -118,7 +117,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().withFacet(null, new HashMap<>());});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));thrown =expectThrows(@@ -126,7 +125,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().withStatFacet(null, "avg(price)");});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -137,7 +136,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().withFacet("anyFacetName", (Map<String, Object>) null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -148,7 +147,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().withFacet("anyFacetName", (MapWriter) null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -159,7 +158,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().withStatFacet("anyFacetName", (String) null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -170,7 +169,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {final JsonQueryRequest request =new JsonQueryRequest().withFacet("top_categories", categoryFacetMap);final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(+ assertThat(requestBody,containsString("\"facet\":{\"top_categories\":{\"field\":\"category\",\"type\":\"terms\"}}"));@@ -189,7 +188,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {final JsonQueryRequest request =new JsonQueryRequest().withFacet("top_categories", facetWriter);final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(+ assertThat(requestBody,containsString("\"facet\":{\"top_categories\":{\"type\":\"terms\",\"field\":\"category\"}}"));@@ -200,8 +199,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {final JsonQueryRequest request =new JsonQueryRequest().withStatFacet("avg_price", "avg(price)");final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(- requestBody, containsString("\"facet\":{\"avg_price\":\"avg(price)\"}"));+ assertThat(requestBody, containsString("\"facet\":{\"avg_price\":\"avg(price)\"}"));}@Test@@ -218,7 +216,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {request.withFacet("facet2", facetMap2);final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(+ assertThat(requestBody,containsString("\"facet\":{\"facet2\":{\"field\":\"b\",\"type\":\"terms\"},\"facet1\":{\"field\":\"a\",\"type\":\"terms\"}}"));@@ -232,14 +230,14 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().setLimit(-1);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-negative"));+ assertThat(thrown.getMessage(), containsString("must be non-negative"));}@Testpublic void testWritesProvidedLimitToJsonCorrectly() {final JsonQueryRequest request = new JsonQueryRequest().setLimit(5);final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(requestBody, containsString("\"limit\":5"));+ assertThat(requestBody, containsString("\"limit\":5"));}@Test@@ -250,14 +248,14 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().setOffset(-1);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-negative"));+ assertThat(thrown.getMessage(), containsString("must be non-negative"));}@Testpublic void testWritesProvidedOffsetToJsonCorrectly() {final JsonQueryRequest request = new JsonQueryRequest().setOffset(5);final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(requestBody, containsString("\"offset\":5"));+ assertThat(requestBody, containsString("\"offset\":5"));}@Test@@ -268,14 +266,14 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().setSort(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Testpublic void testWritesProvidedSortToJsonCorrectly() {final JsonQueryRequest request = new JsonQueryRequest().setSort("price asc");final String requestBody = writeRequestToJson(request, LEAVE_WHITESPACE);- MatcherAssert.assertThat(requestBody, containsString("\"sort\":\"price asc"));+ assertThat(requestBody, containsString("\"sort\":\"price asc"));}@Test@@ -286,7 +284,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().withFilter((String) null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -297,14 +295,14 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().withFilter((Map<String, Object>) null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Testpublic void testWritesProvidedFilterToJsonCorrectly() {final JsonQueryRequest request = new JsonQueryRequest().withFilter("text:solr");final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(requestBody, containsString("\"filter\":[\"text:solr\"]"));+ assertThat(requestBody, containsString("\"filter\":[\"text:solr\"]"));}@Test@@ -312,8 +310,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {final JsonQueryRequest request =new JsonQueryRequest().withFilter("text:solr").withFilter("text:lucene");final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(- requestBody, containsString("\"filter\":[\"text:solr\",\"text:lucene\"]"));+ assertThat(requestBody, containsString("\"filter\":[\"text:solr\",\"text:lucene\"]"));}@Test@@ -324,21 +321,21 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().returnFields((Iterable<String>) null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Testpublic void testWritesProvidedFieldsToJsonCorrectly() {final JsonQueryRequest request = new JsonQueryRequest().returnFields("price");final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(requestBody, containsString("\"fields\":[\"price\"]"));+ assertThat(requestBody, containsString("\"fields\":[\"price\"]"));}@Testpublic void testWritesMultipleProvidedFieldsToJsonCorrectly() {final JsonQueryRequest request = new JsonQueryRequest().returnFields("price", "name");final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(requestBody, containsString("\"fields\":[\"price\",\"name\"]"));+ assertThat(requestBody, containsString("\"fields\":[\"price\",\"name\"]"));}@Test@@ -349,7 +346,7 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().withParam(null, "any-value");});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -360,14 +357,14 @@ public class JsonQueryRequestUnitTest extends SolrTestCase {() -> {new JsonQueryRequest().withParam("any-name", null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Testpublic void testWritesMiscParamsToJsonCorrectly() {final JsonQueryRequest request = new JsonQueryRequest().withParam("fq", "inStock:true");final String requestBody = writeRequestToJson(request);- MatcherAssert.assertThat(requestBody, containsString("\"params\":{\"fq\":\"inStock:true\"}"));+ assertThat(requestBody, containsString("\"params\":{\"fq\":\"inStock:true\"}"));}private String writeRequestToJson(JsonQueryRequest request, boolean trimWhitespace) {diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/QueryFacetMapTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/QueryFacetMapTest.javaindex bb69140accc..bc02fcb41a8 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/QueryFacetMapTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/QueryFacetMapTest.java@@ -20,7 +20,6 @@ package org.apache.solr.client.solrj.request.json;import static org.hamcrest.core.StringContains.containsString;import org.apache.solr.SolrTestCaseJ4;-import org.hamcrest.MatcherAssert;import org.junit.Test;public class QueryFacetMapTest extends SolrTestCaseJ4 {@@ -34,7 +33,7 @@ public class QueryFacetMapTest extends SolrTestCaseJ4 {public void testRejectsInvalidQueryString() {final Throwable thrown =expectThrows(IllegalArgumentException.class, () -> new QueryFacetMap(null));- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Testdiff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/RangeFacetMapTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/RangeFacetMapTest.javaindex 52e885c778f..ca618fd57d1 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/RangeFacetMapTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/RangeFacetMapTest.java@@ -20,7 +20,6 @@ package org.apache.solr.client.solrj.request.json;import static org.hamcrest.core.StringContains.containsString;import org.apache.solr.SolrTestCaseJ4;-import org.hamcrest.MatcherAssert;import org.junit.Test;/** Unit tests for {@link RangeFacetMap} */@@ -33,7 +32,7 @@ public class RangeFacetMapTest extends SolrTestCaseJ4 {() -> {new RangeFacetMap(null, 1, 2, 3);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -44,8 +43,7 @@ public class RangeFacetMapTest extends SolrTestCaseJ4 {() -> {new RangeFacetMap("ANY_FIELD_NAME", 1, -1, 3);});- MatcherAssert.assertThat(- thrown.getMessage(), containsString("'end' must be greater than parameter 'start'"));+ assertThat(thrown.getMessage(), containsString("'end' must be greater than parameter 'start'"));}@Test@@ -56,7 +54,7 @@ public class RangeFacetMapTest extends SolrTestCaseJ4 {() -> {new RangeFacetMap("ANY_FIELD_NAME", 1, 2, -1);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be a positive integer"));+ assertThat(thrown.getMessage(), containsString("must be a positive integer"));}@Test@@ -82,7 +80,7 @@ public class RangeFacetMapTest extends SolrTestCaseJ4 {() -> {new RangeFacetMap("ANY_FIELD_NAME", 1, 2, 3).setOtherBuckets(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Testdiff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/TermsFacetMapTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/TermsFacetMapTest.javaindex 6ff34bedce6..cee8ae6bcc1 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/TermsFacetMapTest.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/TermsFacetMapTest.java@@ -20,7 +20,6 @@ package org.apache.solr.client.solrj.request.json;import static org.hamcrest.core.StringContains.containsString;import org.apache.solr.SolrTestCaseJ4;-import org.hamcrest.MatcherAssert;import org.junit.Test;public class TermsFacetMapTest extends SolrTestCaseJ4 {@@ -47,7 +46,7 @@ public class TermsFacetMapTest extends SolrTestCaseJ4 {final TermsFacetMap termsFacet =new TermsFacetMap(ANY_FIELD_NAME).setBucketOffset(-1);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-negative"));+ assertThat(thrown.getMessage(), containsString("must be non-negative"));}@Test@@ -70,7 +69,7 @@ public class TermsFacetMapTest extends SolrTestCaseJ4 {() -> {final TermsFacetMap termsFacet = new TermsFacetMap(ANY_FIELD_NAME).setSort(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -87,7 +86,7 @@ public class TermsFacetMapTest extends SolrTestCaseJ4 {() -> {final TermsFacetMap termsFacet = new TermsFacetMap(ANY_FIELD_NAME).setOverRequest(-2);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be >= -1"));+ assertThat(thrown.getMessage(), containsString("must be >= -1"));}@Test@@ -111,7 +110,7 @@ public class TermsFacetMapTest extends SolrTestCaseJ4 {() -> {final TermsFacetMap termsFacet = new TermsFacetMap(ANY_FIELD_NAME).setOverRefine(-2);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be >= -1"));+ assertThat(thrown.getMessage(), containsString("must be >= -1"));}@Test@@ -128,7 +127,7 @@ public class TermsFacetMapTest extends SolrTestCaseJ4 {() -> {final TermsFacetMap termsFacet = new TermsFacetMap(ANY_FIELD_NAME).setMinCount(-1);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be a non-negative integer"));+ assertThat(thrown.getMessage(), containsString("must be a non-negative integer"));}@Test@@ -161,7 +160,7 @@ public class TermsFacetMapTest extends SolrTestCaseJ4 {final TermsFacetMap termsFacet =new TermsFacetMap(ANY_FIELD_NAME).setTermPrefix(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Test@@ -179,7 +178,7 @@ public class TermsFacetMapTest extends SolrTestCaseJ4 {final TermsFacetMap termsFacet =new TermsFacetMap(ANY_FIELD_NAME).setFacetMethod(null);});- MatcherAssert.assertThat(thrown.getMessage(), containsString("must be non-null"));+ assertThat(thrown.getMessage(), containsString("must be non-null"));}@Testdiff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.javaindex d0f3ded5bd2..98a0634ca5e 100644--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java@@ -39,6 +39,8 @@ import org.apache.solr.servlet.SolrDispatchFilter;import org.apache.solr.util.ExternalPaths;import org.apache.solr.util.RevertDefaultThreadHandlerRule;import org.apache.solr.util.StartupLoggingUtils;+import org.hamcrest.Matcher;+import org.hamcrest.MatcherAssert;import org.junit.Before;import org.junit.BeforeClass;import org.junit.ClassRule;@@ -191,4 +193,22 @@ public class SolrTestCase extends LuceneTestCase {if (Objects.equals(json2, json1)) return;throw new ComparisonFailure("", expected, actual);}++ /**+ * Hide deprecated inherited method with same signature+ *+ * @see MatcherAssert#assertThat+ */+ public static <T> void assertThat(T actual, Matcher<? super T> matcher) {+ MatcherAssert.assertThat(actual, matcher);+ }++ /**+ * Hide deprecated inherited method with same signature+ *+ * @see MatcherAssert#assertThat+ */+ public static <T> void assertThat(String message, T actual, Matcher<? super T> matcher) {+ MatcherAssert.assertThat(message, actual, matcher);+ }}diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.javaindex a9402a835e1..902192fbbf9 100644--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java@@ -149,7 +149,6 @@ import org.apache.solr.util.StartupLoggingUtils;import org.apache.solr.util.TestHarness;import org.apache.solr.util.TestInjection;import org.apache.zookeeper.KeeperException;-import org.hamcrest.MatcherAssert;import org.junit.After;import org.junit.AfterClass;import org.junit.Before;@@ -224,7 +223,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {if (expectedStrings != null) {for (String expectedString : expectedStrings) {- MatcherAssert.assertThat(thrown.getMessage(), containsString(expectedString));+ assertThat(thrown.getMessage(), containsString(expectedString));}}}diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCloudBackupRestoreTestCase.java b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCloudBackupRestoreTestCase.javaindex 3707d944656..2d0cb44941b 100644--- a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCloudBackupRestoreTestCase.java+++ b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCloudBackupRestoreTestCase.java@@ -48,7 +48,6 @@ import org.apache.solr.common.cloud.Slice;import org.apache.solr.common.cloud.ZkStateReader;import org.apache.solr.common.params.CollectionAdminParams;import org.apache.solr.common.params.CoreAdminParams;-import org.hamcrest.MatcherAssert;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;@@ -219,7 +218,7 @@ public abstract class AbstractCloudBackupRestoreTestCase extends SolrCloudTestCarestore.setConfigName("confFaulty");assertEquals(RequestStatusState.FAILED, restore.processAndWait(solrClient, 30));- MatcherAssert.assertThat(+ assertThat("Failed collection is still in the clusterstate: "+ cluster.getSolrClient()diff --git a/solr/test-framework/src/java/org/apache/solr/util/LogListener.java b/solr/test-framework/src/java/org/apache/solr/util/LogListener.javaindex d989cda6c3f..fcbb453b2b8 100644--- a/solr/test-framework/src/java/org/apache/solr/util/LogListener.java+++ b/solr/test-framework/src/java/org/apache/solr/util/LogListener.java@@ -63,8 +63,8 @@ import org.apache.solr.common.util.SuppressForbidden;* // ... some test code ...** // convinience method for only dealing with Message String of the LogEvent- * MatcherAssert.assertThat(secWarnLog.pollMessage(), containsString("hoss"));- * MatcherAssert.assertThat(secWarnLog.getQueue().isEmpty()); // no other WARNings matching PKI+ * assertThat(secWarnLog.pollMessage(), containsString("hoss"));+ * assertThat(secWarnLog.getQueue().isEmpty()); // no other WARNings matching PKI** // ... more test code ...*diff --git a/solr/test-framework/src/test/org/apache/solr/cloud/JettySolrRunnerTest.java b/solr/test-framework/src/test/org/apache/solr/cloud/JettySolrRunnerTest.javaindex fe125545fa1..9074e182140 100644--- a/solr/test-framework/src/test/org/apache/solr/cloud/JettySolrRunnerTest.java+++ b/solr/test-framework/src/test/org/apache/solr/cloud/JettySolrRunnerTest.java@@ -26,7 +26,6 @@ import java.nio.file.Path;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.embedded.JettyConfig;import org.apache.solr.embedded.JettySolrRunner;-import org.hamcrest.MatcherAssert;import org.junit.Test;public class JettySolrRunnerTest extends SolrTestCaseJ4 {@@ -57,7 +56,7 @@ public class JettySolrRunnerTest extends SolrTestCaseJ4 {jetty.stop();jetty.start(false);- MatcherAssert.assertThat(+ assertThat("After restart, jetty port should be different",jetty.getBaseUrl().getPort(),not(usedPort));diff --git a/solr/test-framework/src/test/org/apache/solr/util/TestErrorLogMuter.java b/solr/test-framework/src/test/org/apache/solr/util/TestErrorLogMuter.javaindex 57bb24a76a5..002ef355356 100644--- a/solr/test-framework/src/test/org/apache/solr/util/TestErrorLogMuter.java+++ b/solr/test-framework/src/test/org/apache/solr/util/TestErrorLogMuter.java@@ -23,7 +23,6 @@ import java.lang.invoke.MethodHandles;import java.util.regex.Pattern;import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.common.util.SuppressForbidden;-import org.hamcrest.MatcherAssert;import org.slf4j.Logger;import org.slf4j.LoggerFactory;@@ -49,8 +48,8 @@ public class TestErrorLogMuter extends SolrTestCaseJ4 {log.warn("This is an warn message, mentioning 'eRrOr Log', that should also not be muted");assertEquals(1, x.getCount());// the root logger better have gotten both of those...- MatcherAssert.assertThat(rootErrorCheck.pollMessage(), containsString("should not mute"));- MatcherAssert.assertThat(rootWarnCheck.pollMessage(), containsString("also not be muted"));+ assertThat(rootErrorCheck.pollMessage(), containsString("should not mute"));+ assertThat(rootWarnCheck.pollMessage(), containsString("also not be muted"));log.error("This {} because of the {} msg",@@ -114,7 +113,7 @@ public class TestErrorLogMuter extends SolrTestCaseJ4 {log.error("this matches the default ignore_exception pattern");log.error("something matching foo that should make it"); // E1assertEquals(1, rootErrorCheck.getCount());- MatcherAssert.assertThat(rootErrorCheck.pollMessage(), containsString("should make it"));+ assertThat(rootErrorCheck.pollMessage(), containsString("should make it"));ignoreException("foo");log.error("something matching foo that should NOT make it");ignoreException("foo");@@ -125,17 +124,17 @@ public class TestErrorLogMuter extends SolrTestCaseJ4 {"A warning should be fine even if it matches ignore_exception and foo and bar"); // W1assertEquals(1, rootErrorCheck.getCount());assertEquals(1, rootWarnCheck.getCount());- MatcherAssert.assertThat(rootErrorCheck.pollMessage(), containsString("should be fine"));+ assertThat(rootErrorCheck.pollMessage(), containsString("should be fine"));unIgnoreException("foo");log.error("another thing matching foo that should make it"); // E2assertEquals(2, rootErrorCheck.getCount());- MatcherAssert.assertThat(rootErrorCheck.pollMessage(), containsString("another thing"));+ assertThat(rootErrorCheck.pollMessage(), containsString("another thing"));log.error("something matching baaaar that should still NOT make it");assertEquals(2, rootErrorCheck.getCount());resetExceptionIgnores();log.error("this still matches the default ignore_exception pattern");log.error("but something matching baaaar should make it now"); // E3- MatcherAssert.assertThat(rootErrorCheck.pollMessage(), containsString("should make it now"));+ assertThat(rootErrorCheck.pollMessage(), containsString("should make it now"));// the root logger must have only gotten the non-muted messages...assertEquals(3, rootErrorCheck.getCount());