@Test void shouldReturnFalsePositiveIfWrongObjectTypeIsReturned() { IssueBuilder builder = new IssueBuilder(); GroovyExpressionMatcher matcher = new GroovyExpressionMatcher(TRUE_SCRIPT); assertThat(matcher.createIssue(null, builder, 0, FILE_NAME)).isEmpty(); }
@SuppressWarnings("all") public Optional<Issue> createIssue(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName) { Object result = run(matcher, builder, lineNumber, fileName); if (result instanceof Optional) { Optional<?> optional = (Optional) result; if (optional.isPresent()) { Object wrappedIssue = optional.get(); if (wrappedIssue instanceof Issue) { return Optional.of((Issue)wrappedIssue); } } } return Optional.empty(); }
GroovyExpressionMatcher implements Serializable { @SuppressWarnings("all") public Optional<Issue> createIssue(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName) { Object result = run(matcher, builder, lineNumber, fileName); if (result instanceof Optional) { Optional<?> optional = (Optional) result; if (optional.isPresent()) { Object wrappedIssue = optional.get(); if (wrappedIssue instanceof Issue) { return Optional.of((Issue)wrappedIssue); } } } return Optional.empty(); } }
GroovyExpressionMatcher implements Serializable { @SuppressWarnings("all") public Optional<Issue> createIssue(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName) { Object result = run(matcher, builder, lineNumber, fileName); if (result instanceof Optional) { Optional<?> optional = (Optional) result; if (optional.isPresent()) { Object wrappedIssue = optional.get(); if (wrappedIssue instanceof Issue) { return Optional.of((Issue)wrappedIssue); } } } return Optional.empty(); } GroovyExpressionMatcher(final String script); }
GroovyExpressionMatcher implements Serializable { @SuppressWarnings("all") public Optional<Issue> createIssue(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName) { Object result = run(matcher, builder, lineNumber, fileName); if (result instanceof Optional) { Optional<?> optional = (Optional) result; if (optional.isPresent()) { Object wrappedIssue = optional.get(); if (wrappedIssue instanceof Issue) { return Optional.of((Issue)wrappedIssue); } } } return Optional.empty(); } GroovyExpressionMatcher(final String script); Script compile(); @SuppressWarnings("all") Optional<Issue> createIssue(final Matcher matcher, final IssueBuilder builder, final int lineNumber,
            final String fileName); Object run(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName); }
GroovyExpressionMatcher implements Serializable { @SuppressWarnings("all") public Optional<Issue> createIssue(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName) { Object result = run(matcher, builder, lineNumber, fileName); if (result instanceof Optional) { Optional<?> optional = (Optional) result; if (optional.isPresent()) { Object wrappedIssue = optional.get(); if (wrappedIssue instanceof Issue) { return Optional.of((Issue)wrappedIssue); } } } return Optional.empty(); } GroovyExpressionMatcher(final String script); Script compile(); @SuppressWarnings("all") Optional<Issue> createIssue(final Matcher matcher, final IssueBuilder builder, final int lineNumber,
            final String fileName); Object run(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName);  }