MLE-26966 Added mock of NuaClient for testing#611
Conversation
|
Copyright Validation Results ✅ Valid Files
✅ All files have valid copyright headers! |
There was a problem hiding this comment.
Pull request overview
This PR introduces a mock implementation of the Nuclia Understanding API (NUA) client to enable testing without making actual API calls. The changes refactor NucliaClient into an interface-based design with DefaultNuaClient as the implementation and MockNuaClient for testing purposes.
Changes:
- Extracted
NuaClientinterface from the originalNucliaClientclass - Renamed
NucliaClienttoDefaultNuaClientand made it implementNuaClient - Added
MockNuaClientfor testing with canned responses - Updated all references throughout the codebase from
NucliaClienttoNuaClient/DefaultNuaClient
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ProcessWithNucliaTest.java | New integration test using MockNuaClient to verify chunk processing and metadata handling |
| DocumentPipelineFactoryTest.java | Updated test assertions to use renamed getNuaClient() method |
| NucliaDocumentProcessor.java | Updated to use NuaClient interface instead of concrete class |
| NuaClient.java | New interface defining the contract for Nuclia API interactions |
| MockNuaClient.java | New mock implementation returning canned responses for testing |
| DefaultNuaClient.java | Renamed from NucliaClient, now implements NuaClient interface |
| DocumentPipelineFactory.java | Updated to instantiate MockNuaClient or DefaultNuaClient based on configuration |
| DocumentPipeline.java | Updated to use NuaClient interface and simplified resource cleanup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| final String expectedChunkUri = "/split-test.json-extracted-text.json-chunks-1.xml"; | ||
| XmlNode doc = readXmlDocument(expectedChunkUri); | ||
| System.out.println(doc.getPrettyXml()); |
There was a problem hiding this comment.
Debug print statement should be removed before merging to production code. Use a logger instead if this output is needed for debugging purposes.
| System.out.println(doc.getPrettyXml()); |
Not testing any connection to Nuclia, but able to test that the model-name and chunk-metadata are handled correctly. NuaClient is now an interface, DefaultNuaClient is the impl, and MockNuaClient is for testing.
c6fca45 to
fc54dfc
Compare
Not testing any connection to Nuclia, but able to test that the model-name and chunk-metadata are handled correctly.
NuaClient is now an interface, DefaultNuaClient is the impl, and MockNuaClient is for testing.