Extension { protected Model getRootPomFile(File folder) throws IOException, XmlPullParserException { FileInputStream fileInputStream = null; Model model; try { MavenXpp3Reader reader = new MavenXpp3Reader(); File pomFile = new File(folder, "pom.xml"); fileInputStream = new FileInputStream(pomFile); model = reader.read(fileInputStream); } finally { if (fileInputStream != null) try { fileInputStream.close(); } catch (IOException e) { logger.error("Error happened when trying to close file", e); } } return model; }  abstract String getDescription(); abstract String getVersion(); final List<Class<? extends TransformationTemplate>> getTemplateClasses(); Optional<Class<? extends TransformationTemplate>> automaticResolution(File applicationFolder); @Override final String toString();  }
@Test(expectedExceptions = XmlPullParserException.class) public void parseErrorRootPomFileTest() throws URISyntaxException, IOException, XmlPullParserException { new SampleExtension().getRootPomFile(new File(getClass().getResource("/sample_pom_files/badPom").toURI())); }
@Test(expectedExceptions = FileNotFoundException.class) public void noRootPomFileTest() throws URISyntaxException, IOException, XmlPullParserException { new SampleExtension().getRootPomFile(new File(getClass().getResource("/sample_pom_files/noPom").toURI())); }