SEARCH-1989 Allow checking ordered values returned in a column. (#6)

This commit is contained in:
Tom Page
2019-11-29 16:27:05 +00:00
committed by GitHub
parent 15dea80d0a
commit d2ab9a7998

View File

@@ -1,5 +1,6 @@
package org.alfresco.cmis.dsl;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
import static org.alfresco.utility.Utility.checkObjectIsInitialized;
@@ -237,6 +238,16 @@ public class QueryExecutor
return this;
}
public <T> QueryResultAssertion isReturningOrderedValues(String queryName, List<T> values)
{
STEP(String.format("Verify that query: '%s' returns the values from %s for column %s", currentQuery, values, queryName));
List<T> resultList = Streams.stream(results).map(r -> (T) r.getPropertyValueByQueryName(queryName)).collect(toList());
// Include both lists in assertion message as TestNG does not provide this information.
Assert.assertEquals(resultList, values, "Values did not match expected " + values + " but found " + resultList);
return this;
}
private String showErrorMessage()
{
return String.format("Returned results count of Query [%s] is not the expected one:", currentQuery);