Open mmondino opened 4 years ago
It would be interesting to have a timeprovider that can be instantiated by passing a clock instance as a parameter.
This would be useful for testing and when working with instances of Clock
private class ClockTimeProvider implements TimeProvider { private Clock clock; public ClockTimeProvider(Clock clock) { this.clock = clock; } @Override public long getTime() throws TimeProviderException { return Instant.now(this.clock).getEpochSecond(); } }
Thanks for the suggestion - I can see the use that this could have in testing, but I'm wondering if a user would not just mock a TimeProvider in this case? Could you elabroate more on the non testing use case?
It would be interesting to have a timeprovider that can be instantiated by passing a clock instance as a parameter.
This would be useful for testing and when working with instances of Clock