CompositeTokenProvider implements TokenProvider { @NotNull public static TokenProvider newInstance(@NotNull TokenProvider... providers) { return newInstance(Arrays.<TokenProvider>asList(providers)); } 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 testSingleProvider() { TokenProvider base = mock(TokenProvider.class); TokenProvider tp = CompositeTokenProvider.newInstance(base); assertSame(base, tp); assertSame(base, CompositeTokenProvider.newInstance(ImmutableList.of(base))); }
@Test public void testCreateCompositeProviderFromList() { TokenProvider base = mock(TokenProvider.class); TokenProvider tp = CompositeTokenProvider.newInstance(ImmutableList.of(base, base)); assertTrue(tp instanceof CompositeTokenProvider); }