Class ExceptionInjection

java.lang.Object
org.apache.drill.exec.testing.Injection
org.apache.drill.exec.testing.ExceptionInjection

public class ExceptionInjection extends Injection
Injection for a single exception. Specifies how many times to inject it, and how many times to skip injecting it before the first injection. This class is used internally for tracking injected exceptions; injected exceptions are specified via the ExecConstants.DRILLBIT_CONTROL_INJECTIONS session option.
  • Method Details

    • throwUnchecked

      public void throwUnchecked()
      Throw the unchecked exception specified by this injection.
      Throws:
      IllegalStateException - if it's time to throw, and the injection specified a checked exception
    • throwChecked

      public <T extends Throwable> void throwChecked(Class<T> exceptionClass) throws T
      Throw the checked exception specified by this injection.
      Parameters:
      exceptionClass - the class of the exception to throw
      Throws:
      T - if it is time to throw the exception
      IllegalStateException - if it is time to throw the exception, and the exception's class is incompatible with the class specified by the injection