类 AbstractJUnit4ContextTests
java.lang.Object
cn.taketoday.test.context.junit4.AbstractJUnit4ContextTests
- 所有已实现的接口:
cn.taketoday.beans.factory.Aware,cn.taketoday.context.ApplicationContextAware
@TestExecutionListeners({ServletTestExecutionListener.class,DirtiesContextBeforeModesTestExecutionListener.class,ApplicationEventsTestExecutionListener.class,DependencyInjectionTestExecutionListener.class,DirtiesContextTestExecutionListener.class,EventPublishingTestExecutionListener.class})
public abstract class AbstractJUnit4ContextTests
extends Object
implements cn.taketoday.context.ApplicationContextAware
Abstract base test class which integrates the Infra TestContext
Framework with explicit
ApplicationContext testing support
in a JUnit 4 environment.
Concrete subclasses should typically declare a class-level
@ContextConfiguration annotation to
configure the application context resource locations or component classes.
This class serves only as a convenience for extension.
- If you do not wish for your test classes to be tied to a Infra-specific
class hierarchy, you may configure your own custom test classes by using
InfraRunner,@ContextConfiguration,@TestExecutionListeners, etc. - If you wish to extend this class and use a runner other than the
InfraRunner, you can useApplicationClassRuleandApplicationMethodRuleand specify your runner of choice via@RunWith(...).
NOTE: This class requires JUnit 4.12 or higher.
- 从以下版本开始:
- 4.0
- 作者:
- Sam Brannen
- 另请参阅:
-
ContextConfigurationTestContextTestContextManagerTestExecutionListenersServletTestExecutionListenerDirtiesContextBeforeModesTestExecutionListenerApplicationEventsTestExecutionListenerDependencyInjectionTestExecutionListenerDirtiesContextTestExecutionListenerEventPublishingTestExecutionListenerAbstractTransactionalJUnit4ContextTests
-
字段概要
字段修饰符和类型字段说明protected cn.taketoday.context.ApplicationContextTheApplicationContextthat was injected into this test instance viasetApplicationContext(ApplicationContext).protected final cn.taketoday.logging.LoggerLogger available to subclasses. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明final voidsetApplicationContext(cn.taketoday.context.ApplicationContext applicationContext) Set theApplicationContextto be used by this test instance, provided viaApplicationContextAwaresemantics.
-
字段详细资料
-
logger
protected final cn.taketoday.logging.Logger loggerLogger available to subclasses. -
applicationContext
@Nullable protected cn.taketoday.context.ApplicationContext applicationContextTheApplicationContextthat was injected into this test instance viasetApplicationContext(ApplicationContext).
-
-
构造器详细资料
-
AbstractJUnit4ContextTests
public AbstractJUnit4ContextTests()
-
-
方法详细资料
-
setApplicationContext
public final void setApplicationContext(cn.taketoday.context.ApplicationContext applicationContext) Set theApplicationContextto be used by this test instance, provided viaApplicationContextAwaresemantics.- 指定者:
setApplicationContext在接口中cn.taketoday.context.ApplicationContextAware- 参数:
applicationContext- the ApplicationContext that this test runs in
-