### Question:
X509AuthenticationProvider extends NiFiAuthenticationProvider { protected static NiFiUser createUser(String identity, Set<String> groups, NiFiUser chain, String clientAddress, boolean isAnonymous) { if (isAnonymous) { return StandardNiFiUser.populateAnonymousUser(chain, clientAddress); } else { return new Builder().identity(identity).groups(groups).chain(chain).clientAddress(clientAddress).build(); } } X509AuthenticationProvider(final X509IdentityProvider certificateIdentityProvider, final Authorizer authorizer, final NiFiProperties nifiProperties); @Override Authentication authenticate(Authentication authentication); @Override boolean supports(Class<?> authentication);  }### Answer:
@Test public void testShouldCreateAnonymousUser() { String identity = "someone"; NiFiUser user = X509AuthenticationProvider.createUser(identity, null, null, null, true); assert user != null; assert user instanceof StandardNiFiUser; assert user.getIdentity().equals(StandardNiFiUser.ANONYMOUS_IDENTITY); assert user.isAnonymous(); }
@Test public void testShouldCreateKnownUser() { String identity = "someone"; NiFiUser user = X509AuthenticationProvider.createUser(identity, null, null, null, false); assert user != null; assert user instanceof StandardNiFiUser; assert user.getIdentity().equals(identity); assert !user.isAnonymous(); }