Introduced new awaitAssert methods accepting java.time.Duration parameters
This commit is contained in:
parent
216025b03f
commit
e5cdf9824c
1 changed files with 28 additions and 1 deletions
|
|
@ -388,9 +388,23 @@ class TestKit(system: ActorSystem) {
|
|||
* which uses the configuration entry "akka.test.timefactor".
|
||||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use the overloaded one which accepts java.time.Duration instead.", since = "2.5.12")
|
||||
@deprecated("Use the overloaded one which accepts java.time.Duration instead.", since = "2.5.13")
|
||||
def awaitAssert[A](max: Duration, a: Supplier[A]): A = tp.awaitAssert(a.get, max)
|
||||
|
||||
/**
|
||||
* Evaluate the given assert every `interval` until it does not throw an exception and return the
|
||||
* result.
|
||||
*
|
||||
* If the `max` timeout expires the last exception is thrown.
|
||||
*
|
||||
* If no timeout is given, take it from the innermost enclosing `within`
|
||||
* block.
|
||||
*
|
||||
* Note that the timeout is scaled using Duration.dilated,
|
||||
* which uses the configuration entry "akka.test.timefactor".
|
||||
*/
|
||||
def awaitAssert[A](max: java.time.Duration, a: Supplier[A]): A = tp.awaitAssert(a.get, max.asScala)
|
||||
|
||||
/**
|
||||
* Evaluate the given assert every `interval` until it does not throw an exception.
|
||||
* If the `max` timeout expires the last exception is thrown.
|
||||
|
|
@ -400,8 +414,21 @@ class TestKit(system: ActorSystem) {
|
|||
*
|
||||
* @return an arbitrary value that would be returned from awaitAssert if successful, if not interested in such value you can return null.
|
||||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use the overloaded one which accepts java.time.Duration instead.", since = "2.5.13")
|
||||
def awaitAssert[A](max: Duration, interval: Duration, a: Supplier[A]): A = tp.awaitAssert(a.get, max, interval)
|
||||
|
||||
/**
|
||||
* Evaluate the given assert every `interval` until it does not throw an exception.
|
||||
* If the `max` timeout expires the last exception is thrown.
|
||||
*
|
||||
* Note that the timeout is scaled using Duration.dilated,
|
||||
* which uses the configuration entry "akka.test.timefactor".
|
||||
*
|
||||
* @return an arbitrary value that would be returned from awaitAssert if successful, if not interested in such value you can return null.
|
||||
*/
|
||||
def awaitAssert[A](max: java.time.Duration, interval: java.time.Duration, a: Supplier[A]): A = tp.awaitAssert(a.get, max.asScala, interval.asScala)
|
||||
|
||||
/**
|
||||
* Same as `expectMsg(remainingOrDefault, obj)`, but correctly treating the timeFactor.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue