Skip to content

Support @BeforeTransaction and @AfterTransaction on interface default methods [SPR-14183] #18754

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
1 task done
spring-projects-issues opened this issue Apr 17, 2016 · 1 comment
Assignees
Labels
in: test Issues in the test module type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Apr 17, 2016

Sam Brannen opened SPR-14183 and commented

Status Quo

Java 8 introduced support for interface default methods. JUnit 5 as well as some existing Runner implementations for JUnit 4.x already support default methods in various scenarios -- for example, @Test, @BeforeEach, etc. However, the Spring TestContext Framework does not yet support the declaration of @BeforeTransaction and @AfterTransaction on default methods: it simply does not find them.

Deliverables

  1. Update the annotated method search algorithms in TransactionalTestExecutionListener so that @BeforeTransaction and @AfterTransaction can be declared on interface default methods.

Issue Links:

Referenced from: commits ff38224, 0f6711f

@spring-projects-issues
Copy link
Collaborator Author

Sam Brannen commented

Completed in GitHub commit 0f6711f:

Support @[Before|After]Transaction on default methods

Prior to this commit, @BeforeTransaction and @AfterTransaction could
only be declared on methods within test classes. However, JUnit 5 as
well as some existing third-party Runner implementations for JUnit 4
already support Java 8 based interface default methods in various
scenarios -- for example, @Test, @BeforeEach, etc.

This commit brings the Spring TestContext Framework up to date by
supporting the declaration of @BeforeTransaction and @AfterTransaction
on interface default methods.

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

2 participants