rombert commented on code in PR #141:
URL: 
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/141#discussion_r1950797031


##########
src/test/java/org/apache/sling/resourceresolver/impl/mapping/MapEntriesTest.java:
##########
@@ -222,15 +233,19 @@ private void prepareMapEntriesForAlias(boolean 
onJcrContent, boolean withNullPar
         when(content.getPath()).thenReturn("/parent/child/jcr:content");
         when(content.getName()).thenReturn("jcr:content");
 
-        
when(aliasResource.getValueMap()).thenReturn(buildValueMap(ResourceResolverImpl.PROP_ALIAS,
 alias));
+        
when(aliasResource.getValueMap()).thenReturn(buildValueMap(ResourceResolverImpl.PROP_ALIAS,
 aliases));
 
-        when(resourceResolver.findResources(anyString(), 
eq("JCR-SQL2"))).thenAnswer((Answer<Iterator<Resource>>) invocation -> {
-            if 
(invocation.getArguments()[0].toString().contains(ResourceResolverImpl.PROP_ALIAS))
 {
-                return List.of(aliasResource).iterator();
-            } else {
-                return Collections.emptyIterator();
-            }
-        });
+        if (queryThrowsWith == null) {

Review Comment:
   I think it would be slightly more readable if you would do something like
   
   ```java
   if ( queryThrowsWith != null ) {
        when(resourceResolver.findResources(anyString(), 
eq("JCR-SQL2"))).thenThrow(queryThrowsWith);
        return;
   }
   ```
   
   But that's personal preference, feel free to leave as-is.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to