-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
inject clock for usage in isDateInTolerance #3037
Conversation
Clock doesn't seem to be used yet, are those commits coming? |
i have a different PR that adds unit tests for the |
For these kinds of PRs it would be good to have an explanation of why they're needed. It's not obvious why this one is needed without the follow up conversation. |
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.
utACK
ok. |
Convert the isDateInTolerance code to use the already available clock instead of using new Date().getTime(). This allow finer control of time in tests and finishes the intention of bisq-network#3037.
Attach a Clock object that can be used instead of System.currentTimeMillis() so that we have more control over the testing of time-sensitive code. Specifically, the code around expiration. This involves attaching a Clock to the resolver so all fromProto methods have one available when they reconstruct a message. This uses the Injector for the APP and a default Clock.systemDefaultZone is used in the manual instantiations. Work was already done in bisq-network#3037 to make this possible. All tests still use the default system clock for now.
Attach a Clock object that can be used instead of System.currentTimeMillis() so that we have more control over the testing of time-sensitive code. Specifically, the code around expiration. This involves attaching a Clock to the resolver so all fromProto methods have one available when they reconstruct a message. This uses the Injector for the APP and a default Clock.systemDefaultZone is used in the manual instantiations. Work was already done in bisq-network#3037 to make this possible. All tests still use the default system clock for now.
Switch from System.currentTimeMills() to Clock.millis() so dependency injection can be used for tests that need finer control of time. This involves attaching a Clock to the resolver so all fromProto methods have one available when they reconstruct a message. This uses the Injector for the APP and a default Clock.systemDefaultZone is used in the manual instantiations. Work was already done in bisq-network#3037 to make this possible. All tests still use the default system clock for now.
No description provided.