Class EvaluatedCondition<T>

  • Type Parameters:
    T - The condition evaluation result value type.

    public class EvaluatedCondition<T>
    extends java.lang.Object
    Contains properties of the condition at its current stage.
    • Field Detail

      • description

        private final java.lang.String description
      • matcher

        private final org.hamcrest.Matcher<? super T> matcher
      • currentConditionValue

        private final T currentConditionValue
      • elapsedTimeInMS

        private final long elapsedTimeInMS
      • pollInterval

        private final java.time.Duration pollInterval
      • remainingTimeInMS

        private final long remainingTimeInMS
      • conditionIsFulfilled

        private final boolean conditionIsFulfilled
      • alias

        private final java.lang.String alias
    • Constructor Detail

      • EvaluatedCondition

        EvaluatedCondition​(java.lang.String description,
                           org.hamcrest.Matcher<? super T> matcher,
                           T currentConditionValue,
                           long elapsedTimeInMS,
                           long remainingTimeInMS,
                           boolean isConditionSatisfied,
                           java.lang.String alias,
                           java.time.Duration pollInterval)
        Parameters:
        description - A descriptive match message or mismatch message of the matcher. If isConditionSatisfied is true then it describes a match message, if false then it describes a mismatch message.
        matcher - The Hamcrest matcher used in the condition
        currentConditionValue - The current value of the condition.
        elapsedTimeInMS - elapsed time in milliseconds.
        remainingTimeInMS - remaining time to wait in milliseconds; Long.MAX_VALUE, if no timeout defined, i.e., running forever.
        isConditionSatisfied - true if the condition is satisfied (i.e. hamcrest matcher matches the value), false otherwise (i.e. an intermediate value).
    • Method Detail

      • getDescription

        public java.lang.String getDescription()
        Returns:
        Descriptive message of the Hamcrest matcher.
      • isHamcrestCondition

        public boolean isHamcrestCondition()
        Returns:
        true if the condition has a matcher (i.e. it's a Hamcrest Based condition) which means that getMatcher() will return a non-null value.
      • getMatcher

        public org.hamcrest.Matcher<? super T> getMatcher()
        Returns:
        The Hamcrest matcher used in the condition if this condition is a Hamcrest condition
        See Also:
        isHamcrestCondition()
      • getValue

        public T getValue()
        Returns:
        The current value of the condition.
      • getElapsedTimeInMS

        public long getElapsedTimeInMS()
        Returns:
        Elapsed time in milliseconds.
      • getRemainingTimeInMS

        public long getRemainingTimeInMS()
        Returns:
        Remaining time to wait in milliseconds or Long.MAX_VALUE if no timeout defined, i.e., running forever.
      • isConditionRunningForever

        public boolean isConditionRunningForever()
        Returns:
        true if the condition doesn't have a timeout, false otherwise.
      • isSatisfied

        public boolean isSatisfied()
        Returns:
        true if the condition is satisfied (i.e. hamcrest matcher matches the value), false otherwise (i.e. an intermediate value).
      • getAlias

        public java.lang.String getAlias()
        Returns:
        The Awaitility alias for the condition (if any).
        See Also:
        hasAlias()
      • hasAlias

        public boolean hasAlias()
        Returns:
        true if this condition defined an alias.
        See Also:
        getAlias()
      • getPollInterval

        public java.time.Duration getPollInterval()
        Returns:
        The poll interval for the evaluation round