### Question:
FileAccessPolicyProvider implements ConfigurableAccessPolicyProvider { @Override public synchronized AccessPolicy addAccessPolicy(AccessPolicy accessPolicy) throws AuthorizationAccessException { if (accessPolicy == null) { throw new IllegalArgumentException("AccessPolicy cannot be null"); } final Policy policy = createJAXBPolicy(accessPolicy); final AuthorizationsHolder holder = authorizationsHolder.get(); final Authorizations authorizations = holder.getAuthorizations(); authorizations.getPolicies().getPolicy().add(policy); saveAndRefreshHolder(authorizations); return authorizationsHolder.get().getPoliciesById().get(accessPolicy.getIdentifier()); }  @Override void initialize(AccessPolicyProviderInitializationContext initializationContext); @Override void onConfigured(AuthorizerConfigurationContext configurationContext); @Override UserGroupProvider getUserGroupProvider(); @Override Set<AccessPolicy> getAccessPolicies(); @Override synchronized AccessPolicy addAccessPolicy(AccessPolicy accessPolicy); @Override AccessPolicy getAccessPolicy(String identifier); @Override AccessPolicy getAccessPolicy(String resourceIdentifier, RequestAction action); @Override synchronized AccessPolicy updateAccessPolicy(AccessPolicy accessPolicy); @Override synchronized AccessPolicy deleteAccessPolicy(AccessPolicy accessPolicy); @AuthorizerContext void setNiFiProperties(NiFiProperties properties); @Override synchronized void inheritFingerprint(String fingerprint); @Override void checkInheritability(String proposedFingerprint); @Override String getFingerprint(); @Override void preDestruction(); @Override void setUserDefaultAccesPilicy(User user);  }### Answer:
@Test public void testAddAccessPolicy() throws Exception { writeFile(primaryAuthorizations, EMPTY_AUTHORIZATIONS); writeFile(primaryTenants, EMPTY_TENANTS); userGroupProvider.onConfigured(configurationContext); accessPolicyProvider.onConfigured(configurationContext); assertEquals(0, accessPolicyProvider.getAccessPolicies().size()); final AccessPolicy policy1 = new AccessPolicy.Builder() .identifier("policy-1") .resource("resource-1") .addUser("user-1") .addGroup("group-1") .action(RequestAction.READ) .build(); final AccessPolicy returnedPolicy1 = accessPolicyProvider.addAccessPolicy(policy1); assertNotNull(returnedPolicy1); assertEquals(policy1.getIdentifier(), returnedPolicy1.getIdentifier()); assertEquals(policy1.getResource(), returnedPolicy1.getResource()); assertEquals(policy1.getUsers(), returnedPolicy1.getUsers()); assertEquals(policy1.getGroups(), returnedPolicy1.getGroups()); assertEquals(policy1.getAction(), returnedPolicy1.getAction()); assertEquals(1, accessPolicyProvider.getAccessPolicies().size()); }