Class Trap

java.lang.Object
org.verifyica.api.Trap

public class Trap extends Object
Class to implement Trap
  • Constructor Details

    • Trap

      public Trap(Trap.Runnable runnable)
      Constructor
      Parameters:
      runnable - runnable
  • Method Details

    • throwable

      public Optional<Throwable> throwable()
      Get the Throwable is trapped
      Returns:
      an Optional containing the trapped Throwable or an empty Optional if no Throwable was trapped
    • isEmpty

      public boolean isEmpty()
      Checks if a Throwable was trapped
      Returns:
      true if no Throwable was trapped, else false
    • assertEmpty

      public void assertEmpty() throws Throwable
      Assert that no Throwable was trapped
      Throws:
      Throwable - The trapped Throwable
    • assertEmpty

      public static void assertEmpty(Trap trap) throws Throwable
      Assert that no Throwable was trapped
      Parameters:
      trap - trap
      Throws:
      Throwable - the first trapped Throwable
    • assertEmpty

      public static void assertEmpty(Trap... traps) throws Throwable
      Assert that no Throwables were trapped
      Parameters:
      traps - traps
      Throws:
      Throwable - the first trapped Throwable
    • assertEmpty

      public static void assertEmpty(Collection<Trap> traps) throws Throwable
      Assert that no Throwables were trapped
      Parameters:
      traps - traps
      Throws:
      Throwable - the first trapped Throwable