### Question:
DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPolicyProvider { @Override public AccessPolicy addAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException { Validate.notNull(accessPolicy); final String policySql = "INSERT INTO APP_POLICY(IDENTIFIER, RESOURCE, ACTION) VALUES (?, ?, ?)"; jdbcTemplate.update(policySql, accessPolicy.getIdentifier(), accessPolicy.getResource(), accessPolicy.getAction().toString()); createPolicyUserAndGroups(accessPolicy); return accessPolicy; }  @AuthorizerContext void setDataSource(final DataSource dataSource); @AuthorizerContext void setIdentityMapper(final IdentityMapper identityMapper); @Override void doOnConfigured(final AuthorizerConfigurationContext configurationContext); @Override void preDestruction(); @Override String getFingerprint(); @Override void inheritFingerprint(String fingerprint); @Override void checkInheritability(String proposedFingerprint); @Override AccessPolicy addAccessPolicy(final AccessPolicy accessPolicy); @Override AccessPolicy updateAccessPolicy(final AccessPolicy accessPolicy); @Override Set<AccessPolicy> getAccessPolicies(); @Override AccessPolicy getAccessPolicy(final String identifier); @Override AccessPolicy getAccessPolicy(final String resourceIdentifier, RequestAction action); @Override AccessPolicy deleteAccessPolicy(final AccessPolicy accessPolicy);  }### Answer:
@Test public void testAddAccessPolicy() { configure(); assertEquals(0, getPolicyCount()); final AccessPolicy policy = new AccessPolicy.Builder() .identifierGenerateRandom() .resource("/buckets") .action(RequestAction.READ) .addUser("user1") .addGroup("group1") .build(); final AccessPolicy createdPolicy = policyProvider.addAccessPolicy(policy); assertNotNull(createdPolicy); final AccessPolicy retrievedPolicy = policyProvider.getAccessPolicy(policy.getIdentifier()); verifyPoliciesEqual(policy, retrievedPolicy); }