Skip to content

Switch to @StartStop for JUnit 5 tests#8863

Merged
swankjesse merged 4 commits into
masterfrom
jwilson.0617_start_stop_start
Jun 18, 2025
Merged

Switch to @StartStop for JUnit 5 tests#8863
swankjesse merged 4 commits into
masterfrom
jwilson.0617_start_stop_start

Conversation

@swankjesse

Copy link
Copy Markdown
Collaborator

No description provided.

This is a new take on our JUnit 5 extension. Rather than creating and managing
the MockWebServer instance in the extension, we let the user create it and all
the extension does is manage the lifecycle.

Note that this annotation doesn't require any external configuration - it doesn't
need a system-property to opt-into 'automatic' extensions, and it doesn't require
a class-level extension either.
@swankjesse
swankjesse requested a review from yschimke June 18, 2025 02:28
@swankjesse
swankjesse force-pushed the jwilson.0617_start_stop_start branch from 9eb6899 to a96c03c Compare June 18, 2025 02:36
var platform = PlatformRule()

private lateinit var server: MockWebServer
private val server = MockWebServer()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This pattern now feels unsafe, since server.stop() must be called.

But existing problem.

Base automatically changed from jwilson.0617.start_stop to master June 18, 2025 11:13
@swankjesse
swankjesse merged commit 5f3ec58 into master Jun 18, 2025
22 checks passed
@swankjesse
swankjesse deleted the jwilson.0617_start_stop_start branch June 18, 2025 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants