question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide a JUnit 5 extension for MockWebServer

See original GitHub issue

I’m trying to get rid of JUnit 4 in my project and the last remaining bit is MockWebServer which depends on org.junit.rules.ExternalResource.

That is not a blocker as org.junit.jupiter:junit-jupiter-migrationsupport provides experimental support for this.

However, it would be great to provide an implementation of MockWebServer following the Junit 5 extension model.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:16
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
JakeWhartoncommented, Mar 2, 2019

Yeah we need to just break this in OkHttp 4 and decouple the need for a server from the idea that you’re inside a test runner.

On Sat, Mar 2, 2019, 3:39 PM Jesse Wilson <notifications@github.com wrote:

Also – we should assume there will be another incompatible library called JUnit 6 in a few years.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/square/okhttp/issues/4667#issuecomment-468958019, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEboweT8OBwWc_PSnR0K4-hGQiqn0ks5vSuGWgaJpZM4bUX4X .

3reactions
wbervoetscommented, Apr 2, 2020

is a different square project for it planned?

MockWebserver probably isn’t considered a top level public API, and upgrading this is awkward. Best fix is probably a lift and shift and API refactor under a different square project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Integration Testing with MockWebServer - Industrial Logic
Our project will include Spring Security with Client Credentials, Actuator, Spring Web, JUnit 5 and Webflux, and some other common ...
Read more >
Doesn't a test class using MockWebServer require a runner?
A JUnit 4 Runner or Rule or JUnit Jupiter Extension conveniently takes care (among other things) of the test setup, e.g. starting and ......
Read more >
Running MockServer
Running MockServer via a JUnit 5 Test Extension. MockServer can be run using the Test Extension MockServerExtension. The MockServerExtension starts ...
Read more >
Getting Started with MockWebServer and JUnit
In this tutorial, we will learn to setup MockWebServer in JUnit 5 tests. We will be using Spring WebClient as HTTP client to...
Read more >
A Guide to JUnit 5 Extensions - Baeldung
JUnit 5 provides a type of extension that can control whether or not a test should be run. This is defined by implementing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found