SimpleCredentialsSupport implements CredentialsSupport { @Override @Nullable public String getUserId(@NotNull Credentials credentials) { if (credentials instanceof SimpleCredentials) { return ((SimpleCredentials) credentials).getUserID(); } else { return null; } } private  SimpleCredentialsSupport(); static CredentialsSupport getInstance(); @Override @NotNull Set<Class> getCredentialClasses(); @Override @Nullable String getUserId(@NotNull Credentials credentials); @Override @NotNull Map<String, ?> getAttributes(@NotNull Credentials credentials); @Override boolean setAttributes(@NotNull Credentials credentials, @NotNull Map<String, ?> attributes);  }
@Test public void testGetUserId() { assertNull(credentialsSupport.getUserId(new TestCredentials())); assertNull(credentialsSupport.getUserId(new SimpleCredentials(null, new char[0]))); assertEquals("uid", credentialsSupport.getUserId(new SimpleCredentials("uid", new char[0]))); }