Class WaitForExecutable

java.lang.Object
org.glassfish.tests.utils.junit.matcher.WaitForExecutable
All Implemented Interfaces:
org.junit.jupiter.api.function.Executable

public class WaitForExecutable extends Object implements org.junit.jupiter.api.function.Executable
Repeats the executable action and catches the AssertionError until the test passes or times out.

Note: Dont't confuse with AssertTimeout

Author:
David Matejcek
  • Method Details

    • waitFor

      public static void waitFor(org.junit.jupiter.api.function.Executable executable, long timeoutInMillis) throws Throwable
      Creates and runs new executable waiting to pass given executable.
      Parameters:
      executable - executable that has to end without errors to pass the test
      timeoutInMillis - timeout to pass
      Throws:
      Throwable - thrown after timeout, not sooner
    • waitUntilPassed

      public static WaitForExecutable waitUntilPassed(org.junit.jupiter.api.function.Executable executable, long timeoutInMillis)
      Creates a new executable waiting to pass given executable. Don't forget to execute in Assertions.assertAll(Executable...) or similar method..
      Parameters:
      executable - executable that has to end without errors to pass the test
      timeoutInMillis - timeout to pass
      Returns:
      new instance of WaitForExecutable
    • execute

      public void execute() throws Throwable
      Specified by:
      execute in interface org.junit.jupiter.api.function.Executable
      Throws:
      Throwable