Skip to content

Add support to query if ApplicationContext is available in the TestContext framework #22756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
sbrannen opened this issue Apr 6, 2019 · 0 comments
Closed
2 tasks done
Assignees
Labels
in: test Issues in the test module type: enhancement A general enhancement
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Apr 6, 2019

Status Quo

A custom TestExecutionListener can gain access to the test's ApplicationContext via TestContext#getApplicationContext(); however, there are times when a custom TestExecutionListener would like to know if the ApplicationContext 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 the ApplicationContext 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's ApplicationContext has already been loaded.

Related Issues

Deliverables

  • Introduce boolean hasApplicationContext() in the TestContext API.
  • Introduce boolean isContextLoaded(MergedContextConfiguration) in the CacheAwareContextLoaderDelegate API.
@sbrannen sbrannen added in: test Issues in the test module type: enhancement A general enhancement labels Apr 6, 2019
@sbrannen sbrannen added this to the 5.2 M1 milestone Apr 6, 2019
@sbrannen sbrannen self-assigned this Apr 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant