0

writing tests and not sure how can one rewrite this code:

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

to reactive one:

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

Note:

first findById() signature is: Optional findById(Long id)

second findById() signature is: Mono findById(ID id)

user994612
  • 35
  • 5

1 Answers1

0

It is possible to do something like this:

Awaitility.await().atMost(1, SECONDS).until({ ->
                Transaction transaction = repository.findAll().blockFirst()
                transaction.currency == USD
                transaction.amount == 20})
Taslim Oseni
  • 6,086
  • 10
  • 44
  • 69
user994612
  • 35
  • 5