Add support to query if ApplicationContext is available in the TestContext framework #22756
Closed
2 tasks done
Labels
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Status Quo
A custom
TestExecutionListener
can gain access to the test'sApplicationContext
viaTestContext#getApplicationContext()
; however, there are times when a customTestExecutionListener
would like to know if theApplicationContext
is already available (i.e., has already been successfully loaded and cached) before proceeding with a particular action.Invoking
TestContext#getApplicationContext()
just to see if theApplicationContext
can be loaded is not a good option, since that will eagerly load the context, potentially resulting in negative side effects.Proposal
Introduce support in the TestContext framework that allows a
TestExecutionListener
to query whether the test'sApplicationContext
has already been loaded.Related Issues
Deliverables
boolean hasApplicationContext()
in theTestContext
API.boolean isContextLoaded(MergedContextConfiguration)
in theCacheAwareContextLoaderDelegate
API.The text was updated successfully, but these errors were encountered: