RepositoryStore { public List<RepositoryName> storedRepositories() { return Collections.unmodifiableList(new ArrayList<RepositoryName>(storedRepositories.keySet())); } RepositoryStore(List<NamedParamRepository> allRepositories, Class<T> storedClass); T get(RepositoryName from); List<RepositoryName> storedRepositories();  }
@Test public void shouldFilterOutRepositoriesAssignableFromStoredClassWhenConstructingStore() { ParamRepository editableRepository = new FakeEditableParamRepository(); List<NamedParamRepository> repositories = Arrays.asList( namedRepository(editableRepository).named("fakeRepo").build(), NamedParamRepositoryBuilder.namedRepository(new FakeViewableParamRepository()).build() ); RepositoryStore<EditableParamRepository> store = new RepositoryStore<EditableParamRepository>( repositories, EditableParamRepository.class); assertThat(store.storedRepositories()).containsOnly(new RepositoryName("fakeRepo")); }