### Question:
StandardManagedAuthorizer implements ManagedAuthorizer { @Override public void inheritFingerprint(String fingerprint) throws AuthorizationAccessException { if (StringUtils.isBlank(fingerprint)) { return; } final FingerprintHolder fingerprintHolder = parseFingerprint(fingerprint); if (StringUtils.isNotBlank(fingerprintHolder.getPolicyFingerprint()) && accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { ((ConfigurableAccessPolicyProvider) accessPolicyProvider).inheritFingerprint(fingerprintHolder.getPolicyFingerprint()); } if (StringUtils.isNotBlank(fingerprintHolder.getUserGroupFingerprint()) && userGroupProvider instanceof ConfigurableUserGroupProvider) { ((ConfigurableUserGroupProvider) userGroupProvider).inheritFingerprint(fingerprintHolder.getUserGroupFingerprint()); } }  @Override void initialize(AuthorizerInitializationContext initializationContext); @Override void onConfigured(AuthorizerConfigurationContext configurationContext); @Override AuthorizationResult authorize(AuthorizationRequest request); boolean isSecurityUserAutoGenerateEnabled(); @Override String getFingerprint(); @Override void inheritFingerprint(String fingerprint); @Override void checkInheritability(String proposedFingerprint); @Override AccessPolicyProvider getAccessPolicyProvider(); @Override void preDestruction();  }### Answer:
@Test public void testInheritEmptyFingerprint() throws Exception { final ConfigurableUserGroupProvider userGroupProvider = mock(ConfigurableUserGroupProvider.class); final ConfigurableAccessPolicyProvider accessPolicyProvider = mock(ConfigurableAccessPolicyProvider.class); when(accessPolicyProvider.getUserGroupProvider()).thenReturn(userGroupProvider); final StandardManagedAuthorizer managedAuthorizer = getStandardManagedAuthorizer(accessPolicyProvider); managedAuthorizer.inheritFingerprint(EMPTY_FINGERPRINT); verify(userGroupProvider, times(0)).inheritFingerprint(anyString()); verify(accessPolicyProvider, times(0)).inheritFingerprint(anyString()); }
@Test(expected = AuthorizationAccessException.class) public void testInheritInvalidFingerprint() throws Exception { final ConfigurableUserGroupProvider userGroupProvider = mock(ConfigurableUserGroupProvider.class); final ConfigurableAccessPolicyProvider accessPolicyProvider = mock(ConfigurableAccessPolicyProvider.class); when(accessPolicyProvider.getUserGroupProvider()).thenReturn(userGroupProvider); final StandardManagedAuthorizer managedAuthorizer = getStandardManagedAuthorizer(accessPolicyProvider); managedAuthorizer.inheritFingerprint("not a valid fingerprint"); }
@Test public void testInheritNonEmptyFingerprint() throws Exception { final ConfigurableUserGroupProvider userGroupProvider = mock(ConfigurableUserGroupProvider.class); final ConfigurableAccessPolicyProvider accessPolicyProvider = mock(ConfigurableAccessPolicyProvider.class); when(accessPolicyProvider.getUserGroupProvider()).thenReturn(userGroupProvider); final StandardManagedAuthorizer managedAuthorizer = getStandardManagedAuthorizer(accessPolicyProvider); managedAuthorizer.inheritFingerprint(NON_EMPTY_FINGERPRINT); verify(userGroupProvider, times(1)).inheritFingerprint(TENANT_FINGERPRINT); verify(accessPolicyProvider, times(1)).inheritFingerprint(ACCESS_POLICY_FINGERPRINT); }