public static void assertQ(String request,String... tests){
  try {
    int queryStartPos=request.indexOf('?');
    String query;
    String path;
    if (-1 == queryStartPos) {
      query="";
      path=request;
    }
 else {
      query=request.substring(queryStartPos + 1);
      path=request.substring(0,queryStartPos);
    }
    if (!query.matches(".*wt=schema\\.xml.*")) {
      query=setParam(query,"wt","xml");
    }
    request=path + '?' + setParam(query,"indent","on");
    String response=restTestHarness.query(request);
    String results=TestHarness.validateXPath(response,tests);
    if (null != results) {
      String msg="REQUEST FAILED: xpath=" + results + "\n\txml response was: "+ response+ "\n\trequest was:"+ request;
      log.error(msg);
      throw new RuntimeException(msg);
    }
  }
 catch (  XPathExpressionException e1) {
    throw new RuntimeException("XPath is invalid",e1);
  }
catch (  Exception e2) {
    SolrException.log(log,"REQUEST FAILED: " + request,e2);
    throw new RuntimeException("Exception during query",e2);
  }
}

public static void assertQ ( String request , String ... tests ) { try { int queryStartPos = request . indexOf ( '?' ) ; String query ; String path ; if ( - 1 == queryStartPos ) { query = "" ; path = request ; } else { query = request . substring ( queryStartPos + 1 ) ; path = request . substring ( 0 , queryStartPos ) ; } if ( ! query . matches ( ".*wt=schema\\.xml.*" ) ) { query = setParam ( query , "wt" , "xml" ) ; } request = path + '?' + setParam ( query , "indent" , "on" ) ; String response = restTestHarness . query ( request ) ; String results = TestHarness . validateXPath ( response , tests ) ; if ( null != results ) { String msg = "REQUEST FAILED: xpath=" + results + "\n\txml response was: " + response + "\n\trequest was:" + request ; log . error ( msg ) ; throw new RuntimeException ( msg ) ; } } catch ( XPathExpressionException e1 ) { throw new RuntimeException ( "XPath is invalid" , e1 ) ; } catch ( Exception e2 ) { SolrException . log ( log , "REQUEST FAILED: " + request , e2 ) ; throw new RuntimeException ( "Exception during query" , e2 ) ; } }
validates a query matches some xpath test expressions
