public WsResponse call(WsRequest request) {
    checkState(!globalMode.isMediumTest(), "No WS call should be made in medium test mode");
    WsResponse response = target.wsConnector().call(request);
    failIfUnauthorized(response);
    checkAuthenticationWarnings(response);
    return response;
  }
@Test
  public void call_whenBadRequest_shouldFailWithMessage() {
    WsRequest request = newRequest();
    server.stubFor(get(urlEqualTo(URL_ENDPOINT))
      .willReturn(aResponse()
        .withStatus(400)
        .withBody("{\"errors\":[{\"msg\":\"Boo! bad request! bad!\"}]}")));

    DefaultScannerWsClient client = new DefaultScannerWsClient(wsClient, true,
      new GlobalAnalysisMode(new ScannerProperties(Collections.emptyMap())), analysisWarnings);
    assertThatThrownBy(() -> client.call(request))
      .isInstanceOf(MessageException.class)
      .hasMessage("Boo! bad request! bad!");
  }