Utils { static boolean taskRequiresProject(Map<String, String> props) { Object task = props.get(ScannerProperties.TASK); return task == null || ScanProperties.SCAN_TASK.equals(task); } private  Utils(); static Properties loadEnvironmentProperties(Map<String, String> env); static void deleteQuietly(Path f);  }
@Test public void task_should_require_project() { Map<String, String> props = new HashMap<>(); assertThat(Utils.taskRequiresProject(props)).isTrue(); props.put("sonar.task", "scan"); assertThat(Utils.taskRequiresProject(props)).isTrue(); }
@Test public void task_should_not_require_project() { Map<String, String> props = new HashMap<>(); props.put("sonar.task", "views"); assertThat(Utils.taskRequiresProject(props)).isFalse(); }