Skip to content

1556 : Update PlayJUnitExtension.java with new implementation#1560

Draft
xael-fry wants to merge 1 commit intoplayframework:masterfrom
xael-fry:fix/tests-play-thread
Draft

1556 : Update PlayJUnitExtension.java with new implementation#1560
xael-fry wants to merge 1 commit intoplayframework:masterfrom
xael-fry:fix/tests-play-thread

Conversation

@xael-fry
Copy link
Member

@xael-fry xael-fry commented Mar 1, 2026

Pull Request Checklist

Helpful things

Fixes

Fixes #xxxx

Purpose

What does this PR do?

Background Context

Why did you take this approach?

References

Are there any relevant issues / PRs / mailing lists discussions?

@xael-fry xael-fry changed the title Update PlayJUnitExtension.java with new implementation 1556 : Update PlayJUnitExtension.java with new implementation Mar 1, 2026
@xael-fry xael-fry marked this pull request as draft March 1, 2026 17:22
@xael-fry xael-fry force-pushed the fix/tests-play-thread branch from cad3996 to 83c944e Compare March 1, 2026 17:24
@xael-fry xael-fry self-assigned this Mar 2, 2026
@xael-fry xael-fry added this to the 1.12.0 milestone Mar 2, 2026
@xael-fry xael-fry linked an issue Mar 2, 2026 that may be closed by this pull request

public static boolean useCustomRunner = false;

private static final ThreadLocal<Invoker.InvocationContext> invocationContext = ThreadLocal.withInitial(() -> null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ThreadLocal<Invoker.InvocationContext> invocationContext = new ThreadLocal();

Play.init(new File("."), getPlayId());
}
// Store invocation context in ThreadLocal for use in interceptTestMethod
invocationContext.set(new Invoker.InvocationContext(invocationType));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion you should add a symmetrical afterEach() method, which will clear the threadlocal variable using invocationContext.remove().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when running tests with fixture in IntelliJ

2 participants