### Question:
FileAuthorizer extends AbstractPolicyBasedAuthorizer { @Override public Set<User> getUsers() throws AuthorizationAccessException { return userGroupProvider.getUsers(); }  @Override void initialize(final AuthorizerInitializationContext initializationContext); @Override void doOnConfigured(final AuthorizerConfigurationContext configurationContext); @Override void preDestruction(); @Override synchronized Group doAddGroup(Group group); @Override Group getGroup(String identifier); @Override synchronized Group doUpdateGroup(Group group); @Override synchronized Group deleteGroup(Group group); @Override Set<Group> getGroups(); @Override synchronized User doAddUser(final User user); @Override User getUser(final String identifier); @Override User getUserByIdentity(final String identity); @Override synchronized User doUpdateUser(final User user); @Override synchronized User deleteUser(final User user); @Override Set<User> getUsers(); @Override synchronized AccessPolicy doAddAccessPolicy(final AccessPolicy accessPolicy); @Override AccessPolicy getAccessPolicy(final String identifier); @Override synchronized AccessPolicy updateAccessPolicy(final AccessPolicy accessPolicy); @Override synchronized AccessPolicy deleteAccessPolicy(final AccessPolicy accessPolicy); @Override Set<AccessPolicy> getAccessPolicies(); @AuthorizerContext void setNiFiProperties(NiFiProperties properties); @Override synchronized UsersAndAccessPolicies getUsersAndAccessPolicies();  }### Answer:
@Test public void testAddUser() throws Exception { writeFile(primaryAuthorizations, EMPTY_AUTHORIZATIONS); writeFile(primaryTenants, EMPTY_TENANTS); authorizer.onConfigured(configurationContext); assertEquals(0, authorizer.getUsers().size()); final User user = new User.Builder() .identifier("user-1") .identity("user-identity-1") .build(); final User addedUser = authorizer.addUser(user); assertNotNull(addedUser); assertEquals(user.getIdentifier(), addedUser.getIdentifier()); assertEquals(user.getIdentity(), addedUser.getIdentity()); final Set<User> users = authorizer.getUsers(); assertEquals(1, users.size()); }
@Test public void testUpdateUserWhenFound() throws Exception { writeFile(primaryAuthorizations, AUTHORIZATIONS); writeFile(primaryTenants, TENANTS); authorizer.onConfigured(configurationContext); assertEquals(2, authorizer.getUsers().size()); final User user = new User.Builder() .identifier("user-1") .identity("new-identity") .build(); final User updatedUser = authorizer.updateUser(user); assertNotNull(updatedUser); assertEquals(user.getIdentifier(), updatedUser.getIdentifier()); assertEquals(user.getIdentity(), updatedUser.getIdentity()); }
@Test public void testUpdateUserWhenNotFound() throws Exception { writeFile(primaryAuthorizations, AUTHORIZATIONS); writeFile(primaryTenants, TENANTS); authorizer.onConfigured(configurationContext); assertEquals(2, authorizer.getUsers().size()); final User user = new User.Builder() .identifier("user-X") .identity("new-identity") .build(); final User updatedUser = authorizer.updateUser(user); assertNull(updatedUser); }