CompositeTokenProvider implements TokenProvider { @Override public boolean doCreateToken(@NotNull Credentials credentials) { for (TokenProvider tp : providers) { if (tp.doCreateToken(credentials)) { return true; } } return false; } private  CompositeTokenProvider(@NotNull List<? extends TokenProvider> providers); @NotNull static TokenProvider newInstance(@NotNull TokenProvider... providers); @NotNull static TokenProvider newInstance(@NotNull List<? extends TokenProvider> providers); @Override boolean doCreateToken(@NotNull Credentials credentials); @Nullable @Override TokenInfo createToken(@NotNull Credentials credentials); @Nullable @Override TokenInfo createToken(@NotNull String userId, @NotNull Map<String, ?> attributes); @Nullable @Override TokenInfo getTokenInfo(@NotNull String token);  }
@Test public void testDoCreateToken() { assertTrue(composite.doCreateToken(new SimpleCredentials(USERID, new char[0]))); assertFalse(composite.doCreateToken(new GuestCredentials())); assertFalse(composite.doCreateToken(new Credentials() {})); }