### Question:
DataAuthorizable implements Authorizable, EnforcePolicyPermissionsThroughBaseResource { @Override public AuthorizationResult checkAuthorization(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext) { if (user == null) { return AuthorizationResult.denied("Unknown user."); } AuthorizationResult result = null; NiFiUser chainedUser = user; do { try { result = Authorizable.super.checkAuthorization(authorizer, action, chainedUser, resourceContext); if (!Result.Approved.equals(result.getResult())) { return result; } chainedUser = chainedUser.getChain(); } catch (final ResourceNotFoundException e) { result = AuthorizationResult.denied("Unknown source component."); } } while (chainedUser != null); if (result == null) { result = AuthorizationResult.denied(); } return result; } DataAuthorizable(final Authorizable authorizable); @Override Authorizable getBaseAuthorizable(); @Override Authorizable getParentAuthorizable(); @Override Resource getResource(); @Override AuthorizationResult checkAuthorization(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext); @Override void authorize(Authorizer authorizer, RequestAction action, NiFiUser user, Map<String, String> resourceContext);  }### Answer:
@Test public void testCheckAuthorizationNullUser() { final AuthorizationResult result = testDataAuthorizable.checkAuthorization(testAuthorizer, RequestAction.READ, null, null); assertEquals(Result.Denied, result.getResult()); }
@Test public void testCheckAuthorizationUnauthorizedUser() { final NiFiUser user = new StandardNiFiUser("unknown"); final AuthorizationResult result = testDataAuthorizable.checkAuthorization(testAuthorizer, RequestAction.READ, user, null); assertEquals(Result.Denied, result.getResult()); }
@Test public void testCheckAuthorizationUnauthorizedUser() { final NiFiUser user = new Builder().identity("unknown").build(); final AuthorizationResult result = testDataAuthorizable.checkAuthorization(testAuthorizer, RequestAction.READ, user, null); assertEquals(Result.Denied, result.getResult()); }