Class TestContext

java.lang.Object
io.micronaut.test.context.TestContext

public class TestContext extends Object
Test context used by TestExecutionListeners.
Since:
1.2
Author:
bidorffOL
  • Constructor Details

    • TestContext

      public TestContext(io.micronaut.context.ApplicationContext applicationContext, Class<?> testClass, AnnotatedElement testMethod, Object testInstance, Throwable testException, String testName, boolean supportsTestMethodInterceptors)
      Parameters:
      applicationContext - The application context
      testClass - The test class
      testMethod - The test method
      testInstance - The test instance
      testException - The exception thrown by the test execution
      testName - The test name
      supportsTestMethodInterceptors - The indicator if the test framework supports TestMethodInterceptor.
  • Method Details

    • getApplicationContext

      public io.micronaut.context.ApplicationContext getApplicationContext()
      Returns:
      The application context
    • getTestClass

      public Class<?> getTestClass()
      Returns:
      The test class
    • getTestException

      public Throwable getTestException()
      Returns:
      The test instance
    • getTestMethod

      public AnnotatedElement getTestMethod()
      Returns:
      The test method
    • getTestInstance

      public Object getTestInstance()
      Returns:
      The exception thrown by the test execution
    • getTestName

      @NonNull public @NonNull String getTestName()
      Returns:
      The test name
    • isSupportsTestMethodInterceptors

      public boolean isSupportsTestMethodInterceptors()
      Returns:
      True if TestMethodInterceptor is supported