solr
solr copied to clipboard
SOLR-16109: Updates SolrTestCaseJ4 ABC doc comparators to static
https://issues.apache.org/jira/browse/SOLR-16109
Description
I'd like to be able to simply compare two SolrInputDocuments in unit tests without absorbing all the overhead that comes with the JUnit test suite.
Solution
Converting the prototype of the following methods to include the static modifier transforms them into functions I can use to this end:
- compareSolrDocument
- compareSolrDocumentList
- compareSolrInputDocument
- assertSolrInputFieldEquals
Tests
Applying this patch to a local solr repo, building the jar locally (after running gradlew check), and including that jar in the library dependencies of my project verify that the static comparators work as expected.
Checklist
Please review the following and check all that apply:
- [x] I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
- [x] I have created a Jira issue and added the issue ID to my pull request title.
- [x] I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
- [x] I have developed this patch against the
mainbranch. - [x] I have run
./gradlew check. - [ ] I have added tests for my changes.
- [ ] I have added documentation for the Reference Guide
I'm not the Java-head to have a strong opinon on this yay or nay, however if we want to make these methods more usable by folks who maybe aren't already Solr coders, could we get some JavaDocs added?
Sure thing, I'll take a look over the JavaDocs and add some information there.
Wondering if the comparators becoming static and moving into a separate class might also be something to consider, to make them (perhaps) more discoverable for use in tests?
@cpoerschke that makes sense to me... @paulkiernan thoughts on moving this forward?
This PR had no visible activity in the past 60 days, labeling it as stale. Any new activity will remove the stale label. To attract more reviewers, please tag someone or notify the [email protected] mailing list. Thank you for your contribution!