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