|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value=TYPE) @Inherited @Documented public @interface TestExecutionListeners
TestExecutionListeners defines class-level metadata for configuring which
TestExecutionListeners
should be registered
with a TestContextManager
. Typically,
@TestExecutionListeners
will be used in
conjunction with @ContextConfiguration
.
TestExecutionListener
,
TestContextManager
,
ContextConfiguration
Required Element Summary | |
---|---|
Class<? extends TestExecutionListener>[] |
value
The TestExecutionListeners to register with
a TestContextManager . |
Optional Element Summary | |
---|---|
boolean |
inheritListeners
Whether or not TestExecutionListeners from superclasses
should be inherited. |
Element Detail |
---|
public abstract Class<? extends TestExecutionListener>[] value
The TestExecutionListeners
to register with
a TestContextManager
.
DependencyInjectionTestExecutionListener
,
DirtiesContextTestExecutionListener
,
TransactionalTestExecutionListener
public abstract boolean inheritListeners
Whether or not TestExecutionListeners
from superclasses
should be inherited.
The default value is true
, which means that an annotated
class will inherit the listeners defined by an annotated
superclass. Specifically, the listeners for an annotated class will be
appended to the list of listeners defined by an annotated superclass.
Thus, subclasses have the option of extending the list of
listeners. In the following example, AbstractBaseTest
will
be configured with DependencyInjectionTestExecutionListener
and DirtiesContextTestExecutionListener
; whereas,
TransactionalTest
will be configured with
DependencyInjectionTestExecutionListener
,
DirtiesContextTestExecutionListener
, and
TransactionalTestExecutionListener
, in that order.
@TestExecutionListeners
({ DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class }) public abstract class AbstractBaseTest { // ... }@TestExecutionListeners
({ TransactionalTestExecutionListener.class }) public class TransactionalTest extends BaseTest { // ... }
If inheritListeners
is set to false
, the
listeners for the annotated class will shadow and effectively
replace any listeners defined by a superclass.
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |