-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add "VirtualTimeScheduler#getScheduledTaskCount()" #1746
Conversation
assertThat(vts.getScheduledTaskCount()).as("a task scheduled").isEqualTo(1); | ||
|
||
// schedule with delay | ||
vts = VirtualTimeScheduler.create(); |
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 suggest splitting it into a few different tests
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.
looks ok in general, requested a test change for better maintainability
Expose "counter" as scheduled task count in VirtualTimeScheduler.
updated the PR. |
@ttddyy thanks for your contribution! 🎉 |
Since VirtualTimeScheduler already has "counter" that keeps track of the number of the scheduled tasks, it can be used to check whether tasks have executed on the scheduler. This change exposes that counter as "scheduled task count". (cherry picked from commit e532799) (backported for the benefit of #1916 backport)
Expose "counter" as scheduled task count in VirtualTimeScheduler.
While testing publisher logic that have
publishOn/subscribeOn
, I'd like to have a way to check provided scheduler has performed the execution.Since
VirtualTimeScheduler
already havecounter
that keeps track of the number of the scheduled tasks, it can be used to check whether tasks have executed on the scheduler.For example,