Using Awaitility to verify a method wasn't called during duration

1.9k Views Asked by At

Is is possible to use awaitility to ensure a method wasn't called during the await?

I have tried using

@Test
void testThatSomeMethodWasntCalled(){
await().atMost(10, TimeUnit.SECONDS).untilAsserted(() -> someClass.someMethod())
}

But there doesn't appear to be a negative version of untilAsserted().

Currently I am using

@Test
void testThatSomeMethodWasntCalled(){
await().atMost(10, TimeUnit.SECONDS)
verify(someClass, never()).someMethod()
}

However the above feels like a glorfied Thread.sleep(...)

Any help would be appricated! Jonny

0

There are 0 best solutions below