### Question:
CommonPermissionCheckingUtils { public void checkPermissionForUserOnResources(AuthorizationResourceAction action, String userCrn, Collection<String> resourceCrns) { DefaultResourceChecker defaultResourceChecker = defaultResourceCheckerMap.get(umsRightProvider.getResourceType(action)); if (defaultResourceChecker == null) { umsResourceAuthorizationService.checkRightOfUserOnResources(userCrn, action, resourceCrns); } else { CrnsByCategory crnsByCategory = defaultResourceChecker.getDefaultResourceCrns(resourceCrns); if (!crnsByCategory.getDefaultResourceCrns().isEmpty()) { throwAccessDeniedIfActionNotAllowed(action, resourceCrns, defaultResourceChecker); } if (!crnsByCategory.getNotDefaultResourceCrns().isEmpty()) { umsResourceAuthorizationService.checkRightOfUserOnResources(userCrn, action, crnsByCategory.getNotDefaultResourceCrns()); } } }  @PostConstruct void init(); boolean legacyAuthorizationNeeded(); ResourceBasedCrnProvider getResourceBasedCrnProvider(AuthorizationResourceAction action); void checkPermissionForUser(AuthorizationResourceAction action, String userCrn); void checkPermissionForUserOnResource(Map<String, AuthorizationResourceAction> resourcesWithActions, String userCrn); void checkPermissionForUserOnResource(AuthorizationResourceAction action, String userCrn, String resourceCrn); void checkPermissionForUserOnResources(AuthorizationResourceAction action,
            String userCrn, Collection<String> resourceCrns); Map<String, Boolean> getPermissionsForUserOnResources(AuthorizationResourceAction action,
            String userCrn, List<String> resourceCrns); Object proceed(ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, long startTime); boolean isAuthorizationDisabled(ProceedingJoinPoint proceedingJoinPoint); boolean isInternalOnly(ProceedingJoinPoint proceedingJoinPoint); T getParameter(ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, Class annotation, Class<T> target);  }### Answer:
@Test public void testCheckPermissionForUserOnMixedResources() { List<String> resourceCrns = List.of(DEFAULT_RESOURCE_CRN, RESOURCE_CRN); underTest.checkPermissionForUserOnResources(AuthorizationResourceAction.DESCRIBE_IMAGE_CATALOG, USER_CRN, resourceCrns); verify(defaultResourceChecker).getDefaultResourceCrns(resourceCrns); verify(defaultResourceChecker).isAllowedAction(AuthorizationResourceAction.DESCRIBE_IMAGE_CATALOG); verify(umsResourceAuthorizationService).checkRightOfUserOnResources(USER_CRN, AuthorizationResourceAction.DESCRIBE_IMAGE_CATALOG, List.of(RESOURCE_CRN)); }
@Test public void testCheckPermissionFailForUserOnMixedResources() { List<String> resourceCrns = List.of(DEFAULT_RESOURCE_CRN, RESOURCE_CRN); AccessDeniedException exception = Assert.assertThrows(AccessDeniedException.class, () -> { underTest.checkPermissionForUserOnResources(AuthorizationResourceAction.DELETE_IMAGE_CATALOG, USER_CRN, resourceCrns); }); assertEquals(exception.getMessage(), "You have no right to perform environments/deleteImageCatalog on resources " + "[DEFAULT_RESOURCE_CRN,RESOURCE_CRN]"); verify(defaultResourceChecker).getDefaultResourceCrns(resourceCrns); verify(defaultResourceChecker).isAllowedAction(AuthorizationResourceAction.DELETE_IMAGE_CATALOG); verifyZeroInteractions(umsResourceAuthorizationService); }