I have an interface defined as follows:
public interface HttpClient {
    public <T> UdemyResponse<T> get(Request request,
      JSONUnmarshaler<T> unmarshaller, Gson gson)
      throws UdemyException, IOException;
}
I have a class that implements the interface:
public class OkHttp implements HttpClient {
public OkHttpClient client;
final Logger logger = LoggerFactory.getLogger(getClass());
public OkHttp() {
    this.client = new OkHttpClient();
}
@Override
public <T> UdemyResponse<T> get(Request request, JSONUnmarshaler<T> unmarshaller, Gson gson)
        throws UdemyException, IOException {
int status_code = 0;
        String next = null;
        String rawJSON = null;
        JsonElement jsonelement = null;
    Boolean retry = true;
    int attempts = 3;
    while ((attempts >= 0) && (retry) && status_code != 200) {
        try {
            Response response = this.client.newCall(request).execute();
            rawJSON = response.body().string();
            jsonelement = gson.fromJson(rawJSON, JsonElement.class);
            next = gson.fromJson(jsonelement.getAsJsonObject().get("next"), String.class);
            status_code = response.code();
            if (status_code == 401) {
                try {
                    logger.warn("token expired");
                    TimeUnit.SECONDS.sleep(5);
                    retry = true;
                    continue;
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            if ((status_code / 100) == 5) {
                logger.warn("gateway error");
                retry = true;
                continue;
            }
        } catch (IOException e) {
            e.printStackTrace();
            // this exception will be propagated to the main method and handled there to exit the program,
            // this exception should end the program.
            throw e;
        }
        attempts -= 1;
        retry = false;
    }   
    if (status_code != 200) {
        throw new UdemyException();
    }
    return new UdemyResponse<T>(status_code, next, rawJSON,
            unmarshaller.fromJSON(gson, jsonelement.getAsJsonObject()));
}
If I mock my interface I can write test cases for get() method but my get() method uses the this.client and I need to mock that object as well.
In this case, is it better to mock the OkHttp object rather than the interface?
 
     
    