futurice / futurice/android-best-practices

Use RESTMock for mocking Retrofit REST services

Open
#116 3 comments 0 reactions 0 assignees View on GitHub
PR welcome
Dominant language
No language data
Stars
20.4k
Forks
3.3k
PR merge metrics
No merged PRs in 30d

Description

Regarding #114, we have been using [RESTMock](https://github.com/andrzejchm/RESTMock) to mock Retrofit calls and it's working like a charm! It uses [OkHttp's MockWebServer](https://github.com/square/okhttp/tree/master/mockwebserver) and it allows to define mock responses for matchers. For instance:

``` java
RESTMockServer.whenGET(pathContains("users/defunkt"))
.thenReturnFile(200, "users/defunkt.json");
```

It also permits to verify if the calls have been done.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.