
main.wisp.sampling.Sleeper.kt Maven / Gradle / Ivy
package wisp.sampling
import java.time.Duration
/**
* Abstraction for `Thread.sleep()` that allows for testing.
*/
interface Sleeper {
fun sleep(duration: Duration)
companion object {
val DEFAULT: Sleeper = object : Sleeper {
override fun sleep(duration: Duration) {
Thread.sleep(duration.toMillis())
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy