This is an automated email from the ASF dual-hosted git repository.

epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-mcp.git


The following commit(s) were added to refs/heads/main by this push:
     new 799deef0 test(indexing): expect one UpdateRequest from the 
multi-document markdown test (#249)
799deef0 is described below

commit 799deef02b97b026195e548ddb98de2b202faf52
Author: Aditya Parikh <[email protected]>
AuthorDate: Tue Oct 6 15:57:22 2026 -0400

    test(indexing): expect one UpdateRequest from the multi-document markdown 
test (#249)
    
    #207 added indexMarkdownDocuments_IndexesEachElementAsItsOwnDocument while
    indexing still called solrClient.add(collection, docs). #233 changed
    indexing to send a single UpdateRequest through solrClient.request(), and
    the two merged without a textual conflict, so the test now verifies a call
    that never happens and fails on main. Stub and capture the UpdateRequest
    like the other indexing tests, and assert it carries both documents.
    
    Signed-off-by: Aditya Parikh <[email protected]>
    Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
---
 .../org/apache/solr/mcp/server/indexing/IndexingServiceTest.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/src/test/java/org/apache/solr/mcp/server/indexing/IndexingServiceTest.java 
b/src/test/java/org/apache/solr/mcp/server/indexing/IndexingServiceTest.java
index 76c8166a..30cdf8d5 100644
--- a/src/test/java/org/apache/solr/mcp/server/indexing/IndexingServiceTest.java
+++ b/src/test/java/org/apache/solr/mcp/server/indexing/IndexingServiceTest.java
@@ -324,14 +324,16 @@ class IndexingServiceTest {
        void indexMarkdownDocuments_IndexesEachElementAsItsOwnDocument() throws 
Exception {
                
when(indexingDocumentCreator.createSchemalessDocumentsFromMarkdown("# 
One")).thenReturn(createMockDocuments(1));
                
when(indexingDocumentCreator.createSchemalessDocumentsFromMarkdown("# 
Two")).thenReturn(createMockDocuments(1));
-               when(solrClient.add(eq("test_collection"), 
any(Collection.class))).thenReturn(null);
+               when(solrClient.request(any(UpdateRequest.class), 
eq("test_collection"))).thenReturn(new NamedList<>());
 
                String result = 
indexingService.indexMarkdownDocuments("test_collection", List.of("# One", "# 
Two"));
 
                assertTrue(result.contains("2 of 2"), result);
                
verify(indexingDocumentCreator).createSchemalessDocumentsFromMarkdown("# One");
                
verify(indexingDocumentCreator).createSchemalessDocumentsFromMarkdown("# Two");
-               verify(solrClient, times(1)).add(eq("test_collection"), 
any(Collection.class));
+               ArgumentCaptor<UpdateRequest> captor = 
ArgumentCaptor.forClass(UpdateRequest.class);
+               verify(solrClient, times(1)).request(captor.capture(), 
eq("test_collection"));
+               assertEquals(2, captor.getValue().getDocuments().size());
        }
 
        @Test

Reply via email to