Expected behavior:
Context should be close()'d after end of test class execution
Observed behavior:
Context only closed when @DirtiesContext annotates method
Multiple test classes can re-use the same context, which allows for faster test execution, so automatically closing a context after test class execution is probably not the best mechanism.
However, there should be a way to annotate that a context should be close()'d after all tests in a test class are executed.
Suggested fix:
- allow @DirtiesContext to annotate class
- add TestExecutionListener#destroyTestInstance
Willing to implementing, if given approval of design.