### Question:
FileEnvironmentRepository implements EnvironmentRepository { @Override public Environment getByName(String name) { return findEnvWith(name).orElseThrow(notFoundException(name)); } FileEnvironmentRepository(File rootDir, FsReader fsReader,
                                     ComponentFactory componentFactory, PropertiesFactory propertiesFactory); @Override List<Environment> environments(); @Override Set<String> environmentNames(); @Override Environment getByName(String name); @Override Environment getOrCreateByName(String name); static final String ENV_DIR; }### Answer:
@Test void envExceptionWrappingOnGroupParse() { File badDir = classpathFile("envs/bad"); FileEnvironmentRepository repo = new FileEnvironmentRepository(badDir, fsReader, componentFactory, propertiesFactory); assertThrows(EnvironmentException.class, () -> repo.getByName("badGroup")); }
@Test void sameEnvNamesException() { File badDir = classpathFile("envs/bad"); FileEnvironmentRepository repo = new FileEnvironmentRepository(badDir, fsReader, componentFactory, propertiesFactory); assertThrows(EnvironmentException.class, () -> repo.getByName("bad")); assertThrows(EnvironmentException.class, () -> repo.getByName("bad2")); assertThrows(IllegalStateException.class, () -> repo.getByName("copy")); }