code: protected static URL buildURL(URL sonarURL, Query query) throws MalformedURLException, IllegalArgumentException {
          if (query.getSonarKey() == null || query.getSonarKey().length() == 0) {
              throw new IllegalArgumentException("No resource specified in the Query");
          }
          String sonarPathWithResource = String.format(SONAR_FORMAT_PATH, query.getSonarKey());
          return new URL(sonarURL, sonarPathWithResource);
      }
docs: Creates a url for the specified quality gate query
  
  @param sonarURL The sonar server we will be querying
  @param query    Holds details on the query we want to make
  @return A URL object representing the query
  @throws MalformedURLException    If the sonar url is not valid
  @throws IllegalArgumentException If the sonar key is not valid