Move MockWebServer TestRule implementation
See original GitHub issueMockWebServer
currently implements TestRule
.
It is probably better to have a separate MockWebServerRule
.
This would allow developers to use MockWebServer
without the junit
dependency.
Optionally, MockWebServerRule
could be moved in to a mockwebserver-junit
package for all junit
-related functionality.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Integrating MockWebServer into production project's UI tests
As you can see I use MockModelWrapper set and pass it to MockDispatcher in test rule's constructor. As you can see it's a...
Read more >Migrating From JUnit 4 to JUnit 5: A Definitive Guide
Learn how to migrate from JUnit 4 to JUnit 5. See how to run existing tests along with the new version, and what...
Read more >Integration Testing with MockWebServer - Industrial Logic
MockWebServer Dependencies. To use MockWebServer, you need two dependencies. Shown below as Gradle imports: testImplementation 'com.squareup.
Read more >Testing - Spring
Test classes that use the TestContext framework do not need to extend any particular class or implement a specific interface to configure their ......
Read more >Testing HTTP applications with a few ok libraries — part 2
We can improve this a little bit by using a JUnit test rule. The implementation of a rule is basically a before() and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just to note that we use TestNG, so having
MockWebServer
pull in junit is a pain.This doesn’t have to wait until OkHttp 4 though. A new class
MockWebServerLight
could be added that did not have the dependency, and the pom.xml could be changed to declare the junit dependency as optional. Even if the pom.xml part was considered too risky, at least end users could exclude it in their pom.Similarly with JUnit 5:
MockWebServer
pulls in JUnit 4 which is undesirable, so a standalone version would be very useful.Ugly but functioning workaround for now is to create a fake empty
org.junit.rules.ExternalResource
class.