code: private HttpResponse getFakeResponse(final int statusCode, final InputStream partContent,
        List<String> headerNames, List<String> headerValues)
        throws IOException {
      HttpRequest request = new FakeResponseHttpTransport(
          statusCode, partContent, headerNames, headerValues).createRequestFactory()
          .buildPostRequest(new GenericUrl("http://google.com/"), null);
      request.setLoggingEnabled(false);
      request.setThrowExceptionOnExecuteError(false);
      return request.execute();
    }
docs: Create a fake HTTP response object populated with the partContent and the statusCode.