Class EventualCondition
- java.lang.Object
-
- de.hybris.platform.integrationservices.util.EventualCondition
-
public class EventualCondition extends java.lang.ObjectA test condition that is evaluated repeatedly during a reasonable period of time. It's intended to assert asynchronous changes. Default evaluation period is 10 seconds and the condition is evaluated approximately every 500 milliseconds.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EventualConditioneventualCondition()Creates evaluation condition with default evaluation period and interval.voidexpect(java.lang.Runnable body)Evaluates the conditions represented by the code body.
-
-
-
Method Detail
-
eventualCondition
public static EventualCondition eventualCondition()
Creates evaluation condition with default evaluation period and interval.- Returns:
- a condition that is evaluated about every 500 milliseconds within 10 seconds period.
-
expect
public void expect(java.lang.Runnable body)
Evaluates the conditions represented by the code body. For example, let's say we have a class Job that changes its state asynchronously. In this case this method can be used like this:Job job = new Job // start the job job.start(); // assert the asynchronous condition that the job eventually finishes. eventualCondition().expect(() -> assertEquals("finished", job.getState());- Parameters:
body- a code to evaluate. It should throw an exception when the condition is not met.
-
-