### Question:
RestAPIAuthorizationFilter extends AbstractAuthorizationFilter { protected boolean staticCheck(final APICallContext apiCallContext, final Set<String> permissionsOfUser, final Set<String> resourcePermissions, final String username) { for (final String resourcePermission : resourcePermissions) { if (permissionsOfUser.contains(resourcePermission)) { return true; } } if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "Unauthorized access to " + apiCallContext.getMethod() + " " + apiCallContext.getApiName() + "/" + apiCallContext.getResourceName() + (apiCallContext.getResourceId() != null ? "/" + apiCallContext.getResourceId() : "") + " attempted by " + username + " required permissions: " + resourcePermissions); } return false; } RestAPIAuthorizationFilter(final boolean reload);  RestAPIAuthorizationFilter();  static final String SCRIPT_TYPE_AUTHORIZATION_PREFIX; }### Answer:
@Test public void test_staticCheck_authorized() throws Exception { final Set<String> userPermissions = new HashSet<String>(Arrays.asList("MyPermission", "AnOtherPermission")); final List<String> resourcePermissions = Arrays.asList("CasePermission", "AnOtherPermission"); returnPermissionFor("GET", "bpm", "case", null, resourcePermissions); final boolean isAuthorized = restAPIAuthorizationFilter.staticCheck(new APICallContext("GET", "bpm", "case", null), userPermissions, new HashSet<String>(resourcePermissions), username); assertThat(isAuthorized).isTrue(); }
@Test public void test_staticCheck_unauthorized() throws Exception { final Set<String> userPermissions = new HashSet<String>(Arrays.asList("MyPermission", "AnOtherPermission")); final List<String> resourcePermissions = Arrays.asList("CasePermission", "SecondPermission"); returnPermissionFor("GET", "bpm", "case", null, resourcePermissions); final boolean isAuthorized = restAPIAuthorizationFilter.staticCheck(new APICallContext("GET", "bpm", "case", null), userPermissions, new HashSet<String>(resourcePermissions), username); assertThat(isAuthorized).isFalse(); }