From d7d7e7234b925dd5c8eb0b7e3500888e8f2728df Mon Sep 17 00:00:00 2001 From: agazzarini Date: Fri, 22 Nov 2019 09:15:51 +0100 Subject: [PATCH] [ SEARCH-1313 ] stream filtering using anyMatch() --- .../functional/AbstractE2EFunctionalTest.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java index 7470000ab..705fb848d 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java @@ -279,18 +279,17 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont } /** - * Method to check if the contentName is returned in the SearchResponse - * @param response - * @param contentName - * @return + * Method to check if the contentName is returned in the SearchResponse. + * + * @param response the search response + * @param contentName the text we are using as matching/verifying criteria. + * @return true if if the item with the contentName text is returned in the SearchResponse. */ public boolean isContentInSearchResponse(SearchResponse response, String contentName) { - boolean found = response.getEntries().stream() + return response.getEntries().stream() .map(entry -> entry.getModel().getName()) - .filter(name -> name.equalsIgnoreCase(contentName) || contentName.isBlank()).count() > 0; - - return found; + .anyMatch(name -> name.equalsIgnoreCase(contentName) || contentName.isBlank()); } /** @@ -426,8 +425,7 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont /** * Helper method to test if the search query works and count matches where provided * @param query: AFTS or cmis query string - * @param expectedCount: Only successful response is checked, when expectedCount is null (can not be exactly specified), - * @param setCmis: Query language is set to cmis when setCmis is true, AFTS when false + * @param expectedCount: Only successful response is checked, when expectedCount is null (can not be exactly specified), * @return SearchResponse */ protected SearchResponse testSearchQuery(String query, Integer expectedCount, SearchLanguage queryLanguage)