  @Test
  public void testFileExistsError() throws Exception {

    server.enqueue(new MockResponse().setResponseCode(500).setBody("Internal error"));

    Exception caughtExc = null;

    try {
      client.fileExists("/path/to/file");
    } catch (Exception exc) {
      caughtExc = exc;
    }

    Assert.assertNotNull(caughtExc);
    Assert.assertEquals(
        "Got error code: 500 message: Server Error body: Internal error", caughtExc.getMessage());

    Assert.assertEquals(1, server.getRequestCount());
  }