You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prior to Java 8 it never really made much sense to author integration tests using interfaces. Consequently, the Spring TestContext Framework has never supported finding test-related annotations on interfaces in its search algorithms.
However, Java 8's support for interface default methods introduces new testing use cases for which it makes sense to declare test configuration (e.g., @ContextConfiguration, etc.) on an interface containing default methods instead of on an abstract base class.
Deliverables
For each of the following annotations, implement and test support for declaration on test interfaces.
@ActiveProfiles
see ActiveProfilesInterfaceTests
@BootstrapWith
see BootstrapWithInterfaceTests
@ContextConfiguration
see ContextConfigurationInterfaceTests
@ContextHierarchy
see ContextHierarchyInterfaceTests
@WebAppConfiguration
see WebAppConfigurationInterfaceTests
@DirtiesContext
see DirtiesContextInterfaceTests
@TestExecutionListeners
see customListenersDeclaredOnInterface() in TestExecutionListenersTests
Sam Brannen opened SPR-14184 and commented
Status Quo
Prior to Java 8 it never really made much sense to author integration tests using interfaces. Consequently, the Spring TestContext Framework has never supported finding test-related annotations on interfaces in its search algorithms.
However, Java 8's support for interface default methods introduces new testing use cases for which it makes sense to declare test configuration (e.g.,
@ContextConfiguration, etc.) on an interface containing default methods instead of on an abstract base class.Deliverables
For each of the following annotations, implement and test support for declaration on test interfaces.
@ActiveProfilesActiveProfilesInterfaceTests@BootstrapWithBootstrapWithInterfaceTests@ContextConfigurationContextConfigurationInterfaceTests@ContextHierarchyContextHierarchyInterfaceTests@WebAppConfigurationWebAppConfigurationInterfaceTests@DirtiesContextDirtiesContextInterfaceTests@TestExecutionListenerscustomListenersDeclaredOnInterface()inTestExecutionListenersTests@TestPropertySourceTestPropertySourceInterfaceTests@Sqland@SqlGroup@Sqlannotations on test interfaces #18827@SqlConfigSqlConfigInterfaceTests@CommitTransactionalTestExecutionListenerTests@RollbackTransactionalTestExecutionListenerTests@IfProfileValueDisabledAnnotatedSingleValueOnTestInterfaceinProfileValueUtilsTests@ProfileValueSourceConfigurationEnabledWithCustomProfileValueSourceOnTestInterfaceinProfileValueUtilsTestsIssue Links:
@BeforeTransactionand@AfterTransactionon interface default methods@Sqlannotations on test interfaces #18827 Support@Sqland@SqlGroupon test interfaces