0

编写测试,但不确定如何重写此代码:

SomeEntity entity = Awaitility.await()
            .atMost(1, TimeUnit.SECONDS)
            .until({ -> repository.findById(id) }, { entry -> entry.isPresent() })
            .get()

反应一:

SomeEntity entity = Awaitility.await()
            .atMost(1, TimeUnit.SECONDS)
            .until({ -> repository.findById(id) }, { entry -> entry.???() })
            .block()

笔记:

第一个 findById() 签名是:可选的 findById(Long id)

第二个 findById() 签名是:Mono findById(ID id)

4

1 回答 1

0

可以这样做:

Awaitility.await().atMost(1, SECONDS).until({ ->
                Transaction transaction = repository.findAll().blockFirst()
                transaction.currency == USD
                transaction.amount == 20})
于 2020-10-06T09:54:19.417 回答