@Test public void should_fail_if_no_binary_dirs() throws IOException { thrown.expect(SonarException.class); thrown.expectMessage("Findbugs needs sources to be compiled"); assertThat(fs.binaryDirs()).isEmpty(); conf.getFindbugsProject(); }
/** @since 1.2 */ @Test public void should_support_multiple_binary_dirs() throws IOException { File binaryDir1 = temp.newFolder("binary1"); File binaryDir2 = temp.newFolder("binary2"); fs.addBinaryDir(binaryDir1); fs.addBinaryDir(binaryDir2); Project findbugsProject = conf.getFindbugsProject(); assertThat(findbugsProject.getFileCount()).isEqualTo(2); assertThat(findbugsProject.getFile(0)).isEqualTo(binaryDir1.getAbsolutePath()); assertThat(findbugsProject.getFile(1)).isEqualTo(binaryDir2.getAbsolutePath()); }
@Test public void should_save_include_config() throws Exception { conf.saveIncludeConfigXml(); File findbugsIncludeFile = new File(fs.workingDir(), "findbugs-include.xml"); assertThat(findbugsIncludeFile.exists()).isTrue(); }
@Test public void should_return_report_file() throws Exception { assertThat(conf.getTargetXMLReport().getCanonicalPath()) .isEqualTo(new File(fs.workingDir(), "findbugs-result.xml").getCanonicalPath()); }