public static void assertFieldValues(SolrDocumentList documents,String fieldName,Object... expectedValues){
  if (documents.size() != expectedValues.length) {
    fail("Number of documents (" + documents.size() + ") is different from number of expected values ("+ expectedValues.length);
  }
  for (int docNum=1; docNum <= documents.size(); ++docNum) {
    SolrDocument doc=documents.get(docNum - 1);
    Object expected=expectedValues[docNum - 1];
    Object actual=doc.get(fieldName);
    if ((null == expected && null != actual) || (null != expected && null == actual) || (null != expected && null != actual && !expected.equals(actual))) {
      fail("Unexpected " + fieldName + " field value in document #"+ docNum+ ": expected=["+ expected+ "], actual=["+ actual+ "]");
    }
  }
}

public static void assertFieldValues ( SolrDocumentList documents , String fieldName , Object ... expectedValues ) { if ( documents . size ( ) != expectedValues . length ) { fail ( "Number of documents (" + documents . size ( ) + ") is different from number of expected values (" + expectedValues . length ) ; } for ( int docNum = 1 ; docNum <= documents . size ( ) ; ++ docNum ) { SolrDocument doc = documents . get ( docNum - 1 ) ; Object expected = expectedValues [ docNum - 1 ] ; Object actual = doc . get ( fieldName ) ; if ( ( null == expected && null != actual ) || ( null != expected && null == actual ) || ( null != expected && null != actual && ! expected . equals ( actual ) ) ) { fail ( "Unexpected " + fieldName + " field value in document #" + docNum + ": expected=[" + expected + "], actual=[" + actual + "]" ) ; } } }
fails if the number of documents in the given solrdocumentlist differs from the given number of expected values , or if any of the values in the given field don ' t match the expected values in the same order .
