### Question:
BasicCredentialsLoader extends AbstractCredentialsLoader<U> { @Override public void load() { this.parse(definitionSource.getCredentialsDefinitions()); } BasicCredentialsLoader(
      CredentialsDefinitionSource<T> definitionSource,
      CredentialsParser<T, U> parser,
      CredentialsRepository<U> credentialsRepository); @Override void load();  }### Answer:
@Test public void testCredentialsLoader() { CredentialsDefinitionSource<CredentialsDefinition> source = mock(CredentialsDefinitionSource.class); CredentialsLifecycleHandler<FakeCredentials> handler = mock(CredentialsLifecycleHandler.class); CredentialsRepository<FakeCredentials> repository = new MapBackedCredentialsRepository<>(TEST_TYPE, handler); BasicCredentialsLoader loader = new BasicCredentialsLoader( source, account -> new FakeCredentials(account.getName()), repository); CredentialsDefinition def1 = mock(CredentialsDefinition.class); when(def1.getName()).thenReturn("cred1"); CredentialsDefinition def2 = mock(CredentialsDefinition.class); when(def2.getName()).thenReturn("cred2"); when(source.getCredentialsDefinitions()).thenReturn(Arrays.asList(def1)); loader.load(); assertThat(repository.getAll()).hasSize(1); assertThat(repository.getOne("cred1")).isNotNull(); assertThat(repository.getOne("cred2")).isNull(); when(source.getCredentialsDefinitions()).thenReturn(Arrays.asList(def2)); loader.load(); assertThat(repository.getAll()).hasSize(1); assertThat(repository.getOne("cred1")).isNull(); assertThat(repository.getOne("cred2")).isNotNull(); when(source.getCredentialsDefinitions()).thenReturn(Collections.emptyList()); loader.load(); assertThat(repository.getAll()).isEmpty(); }