StartStop
Runs MockWebServer for the duration of a test method or test class.
In Java JUnit 5 tests (ie. tests annotated @org.junit.jupiter.api.Test
), use this by defining a field with the @StartStop
annotation:
@StartStop public final MockWebServer server = new MockWebServer();
Content copied to clipboard
Or for Kotlin:
@StartStop val server = MockWebServer()
Content copied to clipboard