public class MockWebServerRule
extends org.junit.rules.ExternalResource
MockWebServer as a JUnit test rule.
This rule starts MockWebServer on an available port before your test runs, and shuts
it down after it completes.
| Constructor and Description |
|---|
MockWebServerRule() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
after() |
protected void |
before() |
void |
enqueue(MockResponse response) |
MockWebServer |
get()
For any other functionality, use the MockWebServer directly.
|
int |
getPort() |
int |
getRequestCount() |
URL |
getUrl(String path) |
RecordedRequest |
takeRequest() |
protected void before()
before in class org.junit.rules.ExternalResourceprotected void after()
after in class org.junit.rules.ExternalResourcepublic int getPort()
public int getRequestCount()
public void enqueue(MockResponse response)
public RecordedRequest takeRequest() throws InterruptedException
InterruptedExceptionpublic MockWebServer get()
Copyright © 2014. All Rights Reserved.