@Test public void shouldThrowInvalidSourceExceptionWhenTryingToGetUnknownRepository() { List<NamedParamRepository> repositories = Arrays.asList( namedRepository(new FakeEditableParamRepository()).build() ); RepositoryStore<EditableParamRepository> store = new RepositoryStore<EditableParamRepository>(repositories, EditableParamRepository.class); try { store.get(RepositoryName.from("invalid name")); Assertions.fail("Expected InvalidSourceRepositoryException."); } catch (InvalidSourceRepositoryException invalidRepoException) { } }
public T get(RepositoryName from) { T repository = storedRepositories.get(from); if (repository == null) { throw new InvalidSourceRepositoryException(from); } return repository; }
RepositoryStore { public T get(RepositoryName from) { T repository = storedRepositories.get(from); if (repository == null) { throw new InvalidSourceRepositoryException(from); } return repository; } }
RepositoryStore { public T get(RepositoryName from) { T repository = storedRepositories.get(from); if (repository == null) { throw new InvalidSourceRepositoryException(from); } return repository; } RepositoryStore(List<NamedParamRepository> allRepositories, Class<T> storedClass); }
RepositoryStore { public T get(RepositoryName from) { T repository = storedRepositories.get(from); if (repository == null) { throw new InvalidSourceRepositoryException(from); } return repository; } RepositoryStore(List<NamedParamRepository> allRepositories, Class<T> storedClass); T get(RepositoryName from); List<RepositoryName> storedRepositories(); }
RepositoryStore { public T get(RepositoryName from) { T repository = storedRepositories.get(from); if (repository == null) { throw new InvalidSourceRepositoryException(from); } return repository; } RepositoryStore(List<NamedParamRepository> allRepositories, Class<T> storedClass); T get(RepositoryName from); List<RepositoryName> storedRepositories();  }