-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOLR-17618: Add unit tests for org.apache.solr.util.TimeOut #3026
base: main
Are you sure you want to change the base?
Conversation
492fe05
to
46da013
Compare
This class did not appear to have any unit tests yet.
46da013
to
387b944
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, some minor comments.
} | ||
|
||
public void testHasTimedOut() { | ||
TimeSource mockTimeSource = mock(TimeSource.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could go in a Before method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh, good point! Thanks, @madrob !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do Before, not BeforeClass for it, and also put the when/thenReturn line in there as well.
Then in the tests adjust the timeouts to test various combinations if we have the same mock time source each time. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay! I think I get it now. Thanks for working with me on this @madrob !
* Add @test annotations * Move repeated mock setup to Before method
This class did not appear to have any unit tests yet.
https://issues.apache.org/jira/browse/SOLR-17618
Description
Adding some unit tests for
org.apache.solr.util.TimeOut
, which did not have unit tests previously (although I believe the tests exercise it in other ways).Solution
Adding a few simple tests
Tests
The attached unit tests pass for me, no functionality changes are included in this pull request.
Checklist
Please review the following and check all that apply:
main
branch../gradlew check
.