@TestExecutionListeners(value={ServletTestExecutionListener.class,DirtiesContextBeforeModesTestExecutionListener.class,ApplicationEventsTestExecutionListener.class,DependencyInjectionTestExecutionListener.class,DirtiesContextTestExecutionListener.class,EventPublishingTestExecutionListener.class}) public abstract class AbstractJUnit4SpringContextTests extends ObjectSE implements ApplicationContextAware
ApplicationContext テストサポートと統合する抽象基本テストクラス。 具象サブクラスは通常、クラスレベルの @ContextConfiguration アノテーションを宣言して、アプリケーションコンテキスト リソースの場所またはコンポーネントクラスを構成する必要があります。テストでアプリケーションコンテキストをロードする必要がない場合は、@ContextConfiguration 宣言を省略し、適切な TestExecutionListeners を手動で構成することを選択できます。
以下の TestExecutionListeners がデフォルトで構成されています。
ServletTestExecutionListenerDirtiesContextBeforeModesTestExecutionListenerApplicationEventsTestExecutionListenerDependencyInjectionTestExecutionListenerDirtiesContextTestExecutionListenerEventPublishingTestExecutionListenerこのクラスは、拡張の便宜としてのみ機能します。
SpringRunner、@ContextConfiguration、@TestExecutionListeners などを使用して独自のカスタムテストクラスを構成できます。SpringRunner 以外のランナーを使用する場合は、SpringClassRule と SpringMethodRule を使用して、@RunWith(...) で選択したランナーを指定できます。注意 : このクラスには、JUnit 4.12 以上が必要です。
ContextConfiguration, TestContext, TestContextManager, TestExecutionListeners, ServletTestExecutionListener, DirtiesContextBeforeModesTestExecutionListener, ApplicationEventsTestExecutionListener, DependencyInjectionTestExecutionListener, DirtiesContextTestExecutionListener, EventPublishingTestExecutionListener, AbstractTransactionalJUnit4SpringContextTests, AbstractTestNGSpringContextTests| 修飾子と型 | フィールドと説明 |
|---|---|
protected ApplicationContext | applicationContextsetApplicationContext(ApplicationContext) を介してこのテストインスタンスに挿入された ApplicationContext。 |
protected Log | logger サブクラスで利用可能なロガー。 |
| コンストラクターと説明 |
|---|
AbstractJUnit4SpringContextTests() |
| 修飾子と型 | メソッドと説明 |
|---|---|
void | setApplicationContext(ApplicationContext applicationContext)ApplicationContextAware セマンティクスを介して提供される、このテストインスタンスによって使用される ApplicationContext を設定します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEprotected final Log logger
@Nullable protected ApplicationContext applicationContext
setApplicationContext(ApplicationContext) を介してこのテストインスタンスに挿入された ApplicationContext。public final void setApplicationContext(ApplicationContext applicationContext)
ApplicationContextAware セマンティクスを介して提供される、このテストインスタンスによって使用される ApplicationContext を設定します。ApplicationContextAware の setApplicationContext applicationContext - このテストが実行される ApplicationContextBeanInitializationException