use of com.squareup.okhttp.mockwebserver.MockWebServer in project enroscar by stanfy.
the class AbstractImagesTest method startServer.
@Before
public void startServer() throws IOException {
server = new MockWebServer();
server.play();
}
use of com.squareup.okhttp.mockwebserver.MockWebServer in project enroscar by stanfy.
the class AbstractMockServerTest method runServer.
@Before
public void runServer() throws IOException {
webServer = new MockWebServer();
webServer.play();
}
use of com.squareup.okhttp.mockwebserver.MockWebServer in project enroscar by stanfy.
the class CacheSwitcherTest method testCacheSwitching.
@Test
public void testCacheSwitching() throws IOException {
final String response1 = "<response to be cached by the FIRST testCache>";
final String response2 = "<response to be cached by the SECOND testCache>";
final MockWebServer webServer = getWebServer();
// two responses
webServer.enqueue(new MockResponse().setBody(response1));
webServer.enqueue(new MockResponse().setBody(response2));
// first request, first cache => not cached
perform("/1/", cache1, response1, false);
// second request, first cache => cached
perform("/1/", cache1, response1, true);
// first request, second cache => not cached
perform("/2/", cache2, response2, false);
// second request, second cache => cached
perform("/2/", cache2, response2, true);
}
Aggregations