Skip to content

Instantly share code, notes, and snippets.

@guelo
Created April 25, 2016 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guelo/6b74921cb118e36caf175cc91a894969 to your computer and use it in GitHub Desktop.
Save guelo/6b74921cb118e36caf175cc91a894969 to your computer and use it in GitHub Desktop.
Mock Retrofit2 service interface.
public interface GitHubService {
@GET("users/{user}/repos")
Call<List<Repo>> listRepos(@Path("user") String user);
}
class MockCall<T> implements Call<T> {
@Override
public Response<T> execute() throws IOException { return null; }
@Override
public void enqueue(Callback<T> callback) {
}
@Override public boolean isExecuted() { return false; }
@Override
public void cancel() { }
@Override
public boolean isCanceled() {
return false;
}
@Override
public Call<T> clone() {
return null;
}
@Override
public Request request() {
return null;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment