FortifyReportFile { InputStream getInputStream() throws IOException { File file = getReportFromProperty(); if (file == null) { throw new FileNotFoundException(); } String fileExtension = FilenameUtils.getExtension(file.getName()); if ("fpr".equalsIgnoreCase(fileExtension)) { return getInputStreamFromFprFile(file); } else { return getInputStreamFromFVDLFile(file); } } FortifyReportFile(FortifySensorConfiguration configuration, FileSystem fileSystem);   }
@Test public void testNotExistgetInputStream() throws IOException { FortifySensorConfiguration configuration = mock(FortifySensorConfiguration.class); when(configuration.getReportPath()).thenReturn(null); FortifyReportFile fortifyReportFile = new FortifyReportFile(configuration, this.fs); InputStream input = null; try { input = fortifyReportFile.getInputStream(); fail("An exception is expected!"); } catch (FileNotFoundException e) { } finally { Closeables.closeQuietly(input); } }
@Test public void testFVDLgetInputStream() throws IOException { FortifySensorConfiguration configuration = mock(FortifySensorConfiguration.class); when(configuration.getReportPath()).thenReturn(System.getProperty("user.dir") + File.separator + "src/test/resources/report/audit.fvdl"); FortifyReportFile fortifyReportFile = new FortifyReportFile(configuration, this.fs); InputStream input = null; try { input = fortifyReportFile.getInputStream(); } finally { Closeables.closeQuietly(input); } }