public PartialConfig parseFile(File file) {
        FileInputStream inputStream = null;
        try {
            inputStream = new FileInputStream(file);
            return loader.fromXmlPartial(inputStream, PartialConfig.class);
        } catch (JDOMParseException jdomex) {
            throw new RuntimeException("Syntax error in xml file: " + file.getName(), jdomex);
        } catch (IOException ioex) {
            throw new RuntimeException("IO error when trying to parse xml file: " + file.getName(), ioex);
        } catch (Exception ex) {
            throw new RuntimeException("Failed to parse xml file: " + file.getName(), ex);
        } finally {
            if (inputStream != null) try {
                inputStream.close();
            } catch (IOException e) {
                LOGGER.error("Failed to close file: {}", file, e);
            }
        }
    }
@Test
    public void shouldParseFileWithOneEnvironment() throws Exception {
        EnvironmentConfig env = EnvironmentConfigMother.environment("dev");

        File file = helper.addFileWithEnvironment("dev-env.gocd.xml", env);

        PartialConfig part = xmlPartialProvider.parseFile(file);

        EnvironmentsConfig loadedEnvs = part.getEnvironments();
        assertThat(loadedEnvs.size(),is(1));
        assertThat(loadedEnvs.get(0),is(env));
    }