@Test public void issues_when_rubocop_file_has_errors() throws IOException { List<ExternalIssue> externalIssues = executeSensorImporting(7, 2, "rubocop-report-with-errors.json"); assertThat(externalIssues).hasSize(7); ExternalIssue first = externalIssues.get(0); assertThat(first.primaryLocation().inputComponent().key()).isEqualTo("rubocop-project:useless-assignment.rb"); assertThat(first.ruleKey().toString()).isEqualTo("rubocop:ruleKey1"); assertThat(first.type()).isEqualTo(RuleType.CODE_SMELL); assertThat(first.severity()).isEqualTo(Severity.MAJOR); assertThat(first.primaryLocation().message()).isEqualTo("message 1"); assertThat(location(first)).isEqualTo("from line 3 offset 2 to line 3 offset 7"); assertThat(logTester.logs(LoggerLevel.ERROR)).isEmpty(); assertThat(onlyOneLogElement(logTester.logs(LoggerLevel.WARN))) .isEqualTo("Fail to resolve 26 file(s). No RuboCop issues will be imported on the following file(s): " + "invalid-path-a.json;invalid-path-b.json;invalid-path-c.json;invalid-path-d.json;invalid-path-e.json;" + "invalid-path-f.json;invalid-path-g.json;invalid-path-h.json;invalid-path-i.json;invalid-path-j.json;" + "invalid-path-k.json;invalid-path-l.json;invalid-path-m.json;invalid-path-n.json;invalid-path-o.json;" + "invalid-path-p.json;invalid-path-q.json;invalid-path-r.json;invalid-path-s.json;invalid-path-t.json;..."); assertThat(logTester.logs(LoggerLevel.DEBUG)).containsExactlyInAnyOrder( "Missing information or unsupported file type for ruleKey:'NotEmptyRuleKey', filePath:'useless-assignment.rb', message:'null'", "Missing information or unsupported file type for ruleKey:'', filePath:'useless-assignment.rb', message:'Valid message.'", "Missing information or unsupported file type for ruleKey:'NotEmptyRuleKey', filePath:'null', message:'Valid message.'"); }
private static boolean isEmpty(@Nullable String value) { return value == null || value.trim().isEmpty(); }
RuboCopSensor implements Sensor { private static boolean isEmpty(@Nullable String value) { return value == null || value.trim().isEmpty(); } }
RuboCopSensor implements Sensor { private static boolean isEmpty(@Nullable String value) { return value == null || value.trim().isEmpty(); }  }
RuboCopSensor implements Sensor { private static boolean isEmpty(@Nullable String value) { return value == null || value.trim().isEmpty(); }  @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); }
RuboCopSensor implements Sensor { private static boolean isEmpty(@Nullable String value) { return value == null || value.trim().isEmpty(); }  @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); static final String REPORT_PROPERTY_KEY; }