Package org.springframework.test.context.support

# Class AbstractTestExecutionListener

java.lang.Object
org.springframework.test.context.support.AbstractTestExecutionListener

All Implemented Interfaces:
  `org.springframework.core.Ordered`, `TestExecutionListener`

Direct Known Subclasses:
  `AbstractDirtiesContextTestExecutionListener`, `ApplicationEventsTestExecutionListener`, `BeanOverrideTestExecutionListener`, `CommonCachesTestExecutionListener`, `DependencyInjectionTestExecutionListener`, `EventPublishingTestExecutionListener`, `MockitoResetTestExecutionListener`, `ServletTestExecutionListener`, `SqlScriptsTestExecutionListener`, `TransactionalTestExecutionListener`

public abstract class AbstractTestExecutionListener extends Object implements TestExecutionListener, org.springframework.core.Ordered
Abstract ordered implementation of the `TestExecutionListener` API.

Since:
  2.5
Author:
  Sam Brannen, Juergen Hoeller
See Also:
  - `getOrder()`

## Field Summary

### Fields inherited from interface org.springframework.core.Ordered

`HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

## Constructor Summary

Constructors
Constructor
Description
`AbstractTestExecutionListener()`

## Method Summary

Modifier and Type
Method
Description
`void`
`afterTestClass(TestContext testContext)`
The default implementation is empty.
`void`
`afterTestExecution(TestContext testContext)`
The default implementation is empty.
`void`
`afterTestMethod(TestContext testContext)`
The default implementation is empty.
`void`
`beforeTestClass(TestContext testContext)`
The default implementation is empty.
`void`
`beforeTestExecution(TestContext testContext)`
The default implementation is empty.
`void`
`beforeTestMethod(TestContext testContext)`
The default implementation is empty.
`int`
`getOrder()`
The default implementation returns `Ordered.LOWEST_PRECEDENCE`, thereby ensuring that custom listeners are ordered after default listeners supplied by the framework.
`void`
`prepareTestInstance(TestContext testContext)`
The default implementation is empty.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AbstractTestExecutionListener

public AbstractTestExecutionListener()

## Method Details

### getOrder

public int getOrder()
The default implementation returns `Ordered.LOWEST_PRECEDENCE`, thereby ensuring that custom listeners are ordered after default listeners supplied by the framework. Can be overridden by subclasses as necessary.

Specified by:
  `getOrder` in interface `org.springframework.core.Ordered`
Since:
  4.1

### beforeTestClass

public void beforeTestClass(TestContext testContext) throws Exception
The default implementation is empty. Can be overridden by subclasses as necessary.

Specified by:
  `beforeTestClass` in interface `TestExecutionListener`
Parameters:
  `testContext` - the test context for the test; never `null`
Throws:
  `Exception` - allows any exception to propagate
Since:
  3.0

### prepareTestInstance

public void prepareTestInstance(TestContext testContext) throws Exception
The default implementation is empty. Can be overridden by subclasses as necessary.

Specified by:
  `prepareTestInstance` in interface `TestExecutionListener`
Parameters:
  `testContext` - the test context for the test; never `null`
Throws:
  `Exception` - allows any exception to propagate

### beforeTestMethod

public void beforeTestMethod(TestContext testContext) throws Exception
The default implementation is empty. Can be overridden by subclasses as necessary.

Specified by:
  `beforeTestMethod` in interface `TestExecutionListener`
Parameters:
  `testContext` - the test context in which the test method will be executed; never `null`
Throws:
  `Exception` - allows any exception to propagate
See Also:
  - `TestExecutionListener.afterTestMethod(org.springframework.test.context.TestContext)`
  - `TestExecutionListener.beforeTestExecution(org.springframework.test.context.TestContext)`
  - `TestExecutionListener.afterTestExecution(org.springframework.test.context.TestContext)`

### beforeTestExecution

public void beforeTestExecution(TestContext testContext) throws Exception
The default implementation is empty. Can be overridden by subclasses as necessary.

Specified by:
  `beforeTestExecution` in interface `TestExecutionListener`
Parameters:
  `testContext` - the test context in which the test method will be executed; never `null`
Throws:
  `Exception` - allows any exception to propagate
Since:
  5.2
See Also:
  - `TestExecutionListener.beforeTestMethod(org.springframework.test.context.TestContext)`
  - `TestExecutionListener.afterTestMethod(org.springframework.test.context.TestContext)`
  - `TestExecutionListener.afterTestExecution(org.springframework.test.context.TestContext)`

### afterTestExecution

public void afterTestExecution(TestContext testContext) throws Exception
The default implementation is empty. Can be overridden by subclasses as necessary.

Specified by:
  `afterTestExecution` in interface `TestExecutionListener`
Parameters:
  `testContext` - the test context in which the test method will be executed; never `null`
Throws:
  `Exception` - allows any exception to propagate
Since:
  5.2
See Also:
  - `TestExecutionListener.beforeTestMethod(org.springframework.test.context.TestContext)`
  - `TestExecutionListener.afterTestMethod(org.springframework.test.context.TestContext)`
  - `TestExecutionListener.beforeTestExecution(org.springframework.test.context.TestContext)`

### afterTestMethod

public void afterTestMethod(TestContext testContext) throws Exception
The default implementation is empty. Can be overridden by subclasses as necessary.

Specified by:
  `afterTestMethod` in interface `TestExecutionListener`
Parameters:
  `testContext` - the test context in which the test method was executed; never `null`
Throws:
  `Exception` - allows any exception to propagate
See Also:
  - `TestExecutionListener.beforeTestMethod(org.springframework.test.context.TestContext)`
  - `TestExecutionListener.beforeTestExecution(org.springframework.test.context.TestContext)`
  - `TestExecutionListener.afterTestExecution(org.springframework.test.context.TestContext)`

### afterTestClass

public void afterTestClass(TestContext testContext) throws Exception
The default implementation is empty. Can be overridden by subclasses as necessary.

Specified by:
  `afterTestClass` in interface `TestExecutionListener`
Parameters:
  `testContext` - the test context for the test; never `null`
Throws:
  `Exception` - allows any exception to propagate
Since:
  3.0