Closed
Description
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.
-
@ActiveProfiles
- see
ActiveProfilesInterfaceTests
- see
-
@BootstrapWith
- see
BootstrapWithInterfaceTests
- see
-
@ContextConfiguration
- see
ContextConfigurationInterfaceTests
- see
-
@ContextHierarchy
- see
ContextHierarchyInterfaceTests
- see
-
@WebAppConfiguration
- see
WebAppConfigurationInterfaceTests
- see
-
@DirtiesContext
- see
DirtiesContextInterfaceTests
- see
-
@TestExecutionListeners
- see
customListenersDeclaredOnInterface()
inTestExecutionListenersTests
- see
-
@TestPropertySource
- see
TestPropertySourceInterfaceTests
- see
-
@Sql
and@SqlGroup
-
@SqlConfig
- see
SqlConfigInterfaceTests
- see
-
@Commit
- see
TransactionalTestExecutionListenerTests
- see
-
@Rollback
- see
TransactionalTestExecutionListenerTests
- see
-
@IfProfileValue
- see
DisabledAnnotatedSingleValueOnTestInterface
inProfileValueUtilsTests
- see
-
@ProfileValueSourceConfiguration
- see
EnabledWithCustomProfileValueSourceOnTestInterface
inProfileValueUtilsTests
- see
Issue Links:
- Support @BeforeTransaction and @AfterTransaction on interface default methods [SPR-14183] #18754 Support
@BeforeTransaction
and@AfterTransaction
on interface default methods - Support
@Sql
annotations on test interfaces #18827 Support@Sql
and@SqlGroup
on test interfaces