### Question:
DefaultInterpreter implements NetworkInterpreter { @Override public void interpretError(int requestId, NetworkInterceptor.TimeInfo timeInfo, Request request, IOException e) { if (Utils.isLoggingEnabled) { Log.d("Error response: ", e.getMessage()); } final OkHttpInspectorRequest okHttpInspectorRequest = new OkHttpInspectorRequest(requestId, request.url().url(), request.method(), Utils.contentLength(request.headers()), request.header(HOST_NAME), request.body()); mEventReporter.httpExchangeError(okHttpInspectorRequest, e); } DefaultInterpreter(NetworkEventReporter mEventReporter); @Override Response interpretResponseStream(int requestId, NetworkInterceptor.TimeInfo timeInfo, Request request, Response response); @Override void interpretError(int requestId, NetworkInterceptor.TimeInfo timeInfo, Request request, IOException e);  }### Answer:
@Test public void testOnHttpExchangeErrorGetsCalled() { NetworkEventReporter networkEventReporter = mock(NetworkEventReporter.class); DefaultInterpreter defaultInterpreter = new DefaultInterpreter(networkEventReporter); NetworkInterceptor.TimeInfo info = new NetworkInterceptor.TimeInfo(); info.mStartTime = 10; info.mEndTime = 20; Request request = new Request.Builder() .url("http: .build(); IOException exception = new IOException("Test error"); defaultInterpreter.interpretError(1, info, request, exception); verify(networkEventReporter, times(1)).httpExchangeError(any(NetworkEventReporter.InspectorRequest.class), eq(exception)); }