Class WaitConditionInvocationHandler<C extends Conditions<?>>

  • Type Parameters:
    C - type of conditions
    All Implemented Interfaces:
    InvocationHandler

    public class WaitConditionInvocationHandler<C extends Conditions<?>>
    extends Object
    implements InvocationHandler
    Invocation handler used to wait for a particular conditions call.
    • Constructor Detail

      • WaitConditionInvocationHandler

        public WaitConditionInvocationHandler​(Class<C> conditionClass,
                                              FluentWait wait,
                                              String context,
                                              Supplier<C> conditionSupplier)
        Creates a new wait condition invocation handler.
        Parameters:
        conditionClass - condition class
        wait - fluent wait
        context - base context of generated message if condition is not verified
        conditionSupplier - supplier of conditions
    • Method Detail

      • conditions

        protected C conditions()
        Get the underlying conditions of wait matcher.
        Returns:
        underlying conditions.
      • conditions

        protected C conditions​(boolean ignoreNot)
        Get the underlying conditions of wait matcher.
        Parameters:
        ignoreNot - true if the negation should be ignored.
        Returns:
        underlying conditions.
      • applyNegation

        protected C applyNegation​(C conditions,
                                  boolean ignoreNegation)
        Apply the current negation to the given condition
        Parameters:
        conditions - conditions.
        ignoreNegation - true if the negation should be ignored.
        Returns:
        conditions with the negation applied.
      • messageBuilder

        protected C messageBuilder()
        Builds a message builder proxy.
        Returns:
        message builder proxy
      • messageBuilder

        protected C messageBuilder​(boolean ignoreNegation)
        Builds a message builder proxy.
        Parameters:
        ignoreNegation - true if the negation should be ignored.
        Returns:
        message builder proxy
      • messageCustomizer

        protected Function<String,​String> messageCustomizer()
        Build the final message from default message.
        Returns:
        final message
      • until

        protected void until​(Predicate<FluentControl> present,
                             String message)
        Perform the wait.
        Parameters:
        present - predicate to wait for.
        message - message to use.
      • until

        protected void until​(Predicate<FluentControl> present,
                             Supplier<String> messageSupplier)
        Perform the wait.
        Parameters:
        present - predicate to wait for.
        messageSupplier - default message to use.
      • until

        protected void until​(C condition,
                             C messageBuilder,
                             Function<C,​Boolean> conditionFunction)
        Perform the wait.
        Parameters:
        condition - condition object to wait for
        messageBuilder - message builder matching the condition object
        conditionFunction - condition function