Skip to content
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

Support test annotations on interfaces [SPR-14184] #18755

spring-issuemaster opened this issue Apr 17, 2016 · 1 comment

Support test annotations on interfaces [SPR-14184] #18755

spring-issuemaster opened this issue Apr 17, 2016 · 1 comment


Copy link

@spring-issuemaster spring-issuemaster commented Apr 17, 2016

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.


For each of the following annotations, implement and test support for declaration on test interfaces.

  1. @ActiveProfiles
    • see ActiveProfilesInterfaceTests
  2. @BootstrapWith
    • see BootstrapWithInterfaceTests
  3. @ContextConfiguration
    • see ContextConfigurationInterfaceTests
  4. @ContextHierarchy
    • see ContextHierarchyInterfaceTests
  5. @WebAppConfiguration
    • see WebAppConfigurationInterfaceTests
  6. @DirtiesContext
    • see DirtiesContextInterfaceTests
  7. @TestExecutionListeners
    • see customListenersDeclaredOnInterface() in TestExecutionListenersTests
  8. @TestPropertySource
    • see TestPropertySourceInterfaceTests
  9. @Sql and @SqlGroup
  10. @SqlConfig
    • see SqlConfigInterfaceTests
  11. @Commit
    • see TransactionalTestExecutionListenerTests
  12. @Rollback
    • see TransactionalTestExecutionListenerTests
  13. @IfProfileValue
    • see DisabledAnnotatedSingleValueOnTestInterface in ProfileValueUtilsTests
  14. @ProfileValueSourceConfiguration
    • see EnabledWithCustomProfileValueSourceOnTestInterface in ProfileValueUtilsTests

Issue Links:

  • #18754 Support @BeforeTransaction and @AfterTransaction on interface default methods
  • #18827 Support @Sql and @SqlGroup on test interfaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.