You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2026/09/23 14:33:10 UTC
(solr) branch main updated: SOLR-18226: test, fix mock error-prone violation
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 78891191f4a SOLR-18226: test, fix mock error-prone violation
78891191f4a is described below
commit 78891191f4aa748db803e7932593362893b44cd0
Author: David Smiley <ds...@apache.org>
AuthorDate: Wed Sep 23 10:32:59 2026 -0400
SOLR-18226: test, fix mock error-prone violation
---
.../apache/solr/handler/admin/api/CoreReplicationAPITest.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/CoreReplicationAPITest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/CoreReplicationAPITest.java
index a4091f56aeb..cd7de60c095 100644
--- a/solr/core/src/test/org/apache/solr/handler/admin/api/CoreReplicationAPITest.java
+++ b/solr/core/src/test/org/apache/solr/handler/admin/api/CoreReplicationAPITest.java
@@ -51,6 +51,8 @@ public class CoreReplicationAPITest extends SolrTestCaseJ4 {
private CoreReplication coreReplicationAPI;
private SolrCore mockCore;
private ReplicationHandler mockReplicationHandler;
+ private Path configPath;
+ private Path tlogDir;
@BeforeClass
public static void ensureWorkingMockito() {
@@ -210,11 +212,9 @@ public class CoreReplicationAPITest extends SolrTestCaseJ4 {
// against those checks over-rejecting.
// Also exercises the normalize() applied to the resolved path by
// resolveWithinOrForbidden; the on-disk file must still be readable.
- Path configPath = mockCore.getResourceLoader().getConfigPath();
Files.createDirectories(configPath.resolve("lang"));
Path cfFile = configPath.resolve("lang").resolve("en.txt");
Files.writeString(cfFile, "hello");
- Path tlogDir = Path.of(mockCore.getUpdateHandler().getUpdateLog().getTlogDir());
Files.createDirectories(tlogDir.resolve("nested"));
Path tlogFile = tlogDir.resolve("nested").resolve("tlog.0");
Files.writeString(tlogFile, "hello");
@@ -286,12 +286,13 @@ public class CoreReplicationAPITest extends SolrTestCaseJ4 {
// Mocks for LocalFsTlogFileStream
UpdateHandler mockUpdateHandler = mock(UpdateHandler.class);
UpdateLog mockUpdateLog = mock(UpdateLog.class);
+ tlogDir = createTempDir("coreReplicationTlog");
when(mockUpdateHandler.getUpdateLog()).thenReturn(mockUpdateLog);
- when(mockUpdateLog.getTlogDir()).thenReturn(createTempDir("coreReplicationTlog").toString());
+ when(mockUpdateLog.getTlogDir()).thenReturn(tlogDir.toString());
// Mocks for LocalFsConfFileStream
SolrResourceLoader mockSolrResourceLoader = mock(SolrResourceLoader.class);
- Path configPath = createTempDir("coreReplicationConf");
+ configPath = createTempDir("coreReplicationConf");
when(mockCore.getRequestHandler(ReplicationHandler.PATH)).thenReturn(mockReplicationHandler);
when(mockCore.getUpdateHandler()).thenReturn(mockUpdateHandler);
when(mockCore.getResourceLoader()).thenReturn(mockSolrResourceLoader);