public void validateUrl(String serverUrl) {
    HttpUrl url = buildUrl(serverUrl, "/rest/api/1.0/repos");
    doGet("", url, body -> buildGson().fromJson(body, RepositoryList.class));
  }
@Test
  public void fail_validate_url_when_body_is_empty() {
    server.enqueue(new MockResponse().setResponseCode(404).setBody(""));

    String serverUrl = server.url("/").toString();
    assertThatThrownBy(() -> underTest.validateUrl(serverUrl))
      .isInstanceOf(BitbucketServerException.class)
      .hasMessage("Error 404. The requested Bitbucket server is unreachable.")
      .extracting(e -> ((BitbucketServerException) e).getHttpStatus()).isEqualTo(404);
  }