Package org.awaitility.core
Class ConditionEvaluationLogger
- java.lang.Object
-
- org.awaitility.core.ConditionEvaluationLogger
-
- All Implemented Interfaces:
ConditionEvaluationListener<java.lang.Object>
public class ConditionEvaluationLogger extends java.lang.Object implements ConditionEvaluationListener<java.lang.Object>
Simple implementation ofConditionEvaluationListenerthat prints the condition evaluation results to the console usingSystem.out.printlnby default. You can customize the how the results are written by providing a custom consumer that prints the results.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Consumer<java.lang.String>logPrinterprivate java.util.concurrent.TimeUnitunit
-
Constructor Summary
Constructors Constructor Description ConditionEvaluationLogger()UsesTimeUnit.MILLISECONDSas unit for elapsed and remaining time.ConditionEvaluationLogger(java.util.concurrent.TimeUnit unit)Specifies theTimeUnitto use as unit for elapsed and remaining time.ConditionEvaluationLogger(java.util.function.Consumer<java.lang.String> logPrinter)Specifies a consumer that is responsible for actually printing the logsConditionEvaluationLogger(java.util.function.Consumer<java.lang.String> logPrinter, java.util.concurrent.TimeUnit unit)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeEvaluation(StartEvaluationEvent<java.lang.Object> condition)Handle the startEvaluationEvent.voidconditionEvaluated(EvaluatedCondition<java.lang.Object> condition)Handle an evaluated condition of a matcher.static ConditionEvaluationLoggerconditionEvaluationLogger()Syntactic sugar to avoid writing thenewkeyword in Java.static ConditionEvaluationLoggerconditionEvaluationLogger(java.util.concurrent.TimeUnit unit)Syntactic sugar to avoid writing thenewkeyword in Java.static ConditionEvaluationLoggerconditionEvaluationLogger(java.util.function.Consumer<java.lang.String> logger)Syntactic sugar to avoid writing thenewkeyword in Java.voidexceptionIgnored(IgnoredException ignoredException)Handle ignored exception that get thrown while condition evaluation.voidonTimeout(TimeoutEvent timeoutEvent)Handle the timeoutEvent.
-
-
-
Constructor Detail
-
ConditionEvaluationLogger
public ConditionEvaluationLogger()
UsesTimeUnit.MILLISECONDSas unit for elapsed and remaining time.
-
ConditionEvaluationLogger
public ConditionEvaluationLogger(java.util.function.Consumer<java.lang.String> logPrinter)
Specifies a consumer that is responsible for actually printing the logs- Parameters:
logPrinter- The logger to use
-
ConditionEvaluationLogger
public ConditionEvaluationLogger(java.util.concurrent.TimeUnit unit)
Specifies theTimeUnitto use as unit for elapsed and remaining time.- Parameters:
unit- The time unit to use.
-
ConditionEvaluationLogger
public ConditionEvaluationLogger(java.util.function.Consumer<java.lang.String> logPrinter, java.util.concurrent.TimeUnit unit)
-
-
Method Detail
-
conditionEvaluated
public void conditionEvaluated(EvaluatedCondition<java.lang.Object> condition)
Description copied from interface:ConditionEvaluationListenerHandle an evaluated condition of a matcher.- Specified by:
conditionEvaluatedin interfaceConditionEvaluationListener<java.lang.Object>- Parameters:
condition- The condition evaluation result containing various properties of the result of evaluated condition
-
beforeEvaluation
public void beforeEvaluation(StartEvaluationEvent<java.lang.Object> condition)
Description copied from interface:ConditionEvaluationListenerHandle the startEvaluationEvent. Method is default to keep the ConditionEvaluationListener backward compatible.- Specified by:
beforeEvaluationin interfaceConditionEvaluationListener<java.lang.Object>- Parameters:
condition- the event containing various properties of the condition evaluation to be started
-
onTimeout
public void onTimeout(TimeoutEvent timeoutEvent)
Description copied from interface:ConditionEvaluationListenerHandle the timeoutEvent. Method is default to keep the ConditionEvaluationListener backward compatible.- Specified by:
onTimeoutin interfaceConditionEvaluationListener<java.lang.Object>- Parameters:
timeoutEvent- the event containing some properties about the condition evaluation timeout
-
exceptionIgnored
public void exceptionIgnored(IgnoredException ignoredException)
Description copied from interface:ConditionEvaluationListenerHandle ignored exception that get thrown while condition evaluation. Method is default to keep the ConditionEvaluationListener backward compatible.- Specified by:
exceptionIgnoredin interfaceConditionEvaluationListener<java.lang.Object>- Parameters:
ignoredException- contains the ignored Throwable and various properties of the evaluation
-
conditionEvaluationLogger
public static ConditionEvaluationLogger conditionEvaluationLogger(java.util.function.Consumer<java.lang.String> logger)
Syntactic sugar to avoid writing thenewkeyword in Java. UsesTimeUnit.MILLISECONDSas unit for elapsed and remaining time.- Returns:
- A new instance of
ConditionEvaluationLogger
-
conditionEvaluationLogger
public static ConditionEvaluationLogger conditionEvaluationLogger()
Syntactic sugar to avoid writing thenewkeyword in Java. UsesTimeUnit.MILLISECONDSas unit for elapsed and remaining time.- Returns:
- A new instance of
ConditionEvaluationLogger
-
conditionEvaluationLogger
public static ConditionEvaluationLogger conditionEvaluationLogger(java.util.concurrent.TimeUnit unit)
Syntactic sugar to avoid writing thenewkeyword in Java. Specifies theTimeUnitto use as unit for elapsed and remaining time.- Parameters:
unit- The time unit to use.
-
-