@Test public void shouldExecuteOnlyWhenNecessary() { // which means: only on cxx projects CxxReportSensor sensor = new CxxSensorImpl(); Project cxxProject = mockProjectWithLanguageKey(CxxLanguage.KEY); Project foreignProject = mockProjectWithLanguageKey("whatever"); assert (sensor.shouldExecuteOnProject(cxxProject)); assert (!sensor.shouldExecuteOnProject(foreignProject)); }
@Test public void getReports_shouldFallbackToDefaultIfNothingConfigured() { List<File> reports = sensor.getReports( new Settings(), baseDir.getPath(), REPORT_PATH_PROPERTY_KEY, VALID_REPORT_PATH); assertFound(reports); }
@Test public void getReports_shouldUseConfigurationWithHigherPriority() { // we'll detect this condition by passing something not existing as config property // and something existing as default. The result is 'found nothing' because the // config has been used Settings config = new Settings(); config.setProperty(REPORT_PATH_PROPERTY_KEY, INVALID_REPORT_PATH); List<File> reports = sensor.getReports(config, baseDir.getPath(), REPORT_PATH_PROPERTY_KEY, VALID_REPORT_PATH); assertNotFound(reports); }
@Test public void getReports_shouldFindNothingIfNotThere() { List<File> reports = sensor.getReports(new Settings(), baseDir.getPath(), "", INVALID_REPORT_PATH); assertNotFound(reports); }