@Test void shouldCreateScriptIfSourceCodeIsValid() { assertThat(createMatcher(TRUE_SCRIPT).run()).isEqualTo(true); assertThat(createMatcher(FALSE_SCRIPT).run()).isEqualTo(false); }
public Object run(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName) { if (compileScriptIfNotYetDone()) { Binding binding = compiled.getBinding(); binding.setVariable("matcher", matcher); binding.setVariable("builder", builder); binding.setVariable("lineNumber", lineNumber); binding.setVariable("fileName", fileName); return runScript(); } return Optional.empty(); }
GroovyExpressionMatcher implements Serializable { public Object run(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName) { if (compileScriptIfNotYetDone()) { Binding binding = compiled.getBinding(); binding.setVariable("matcher", matcher); binding.setVariable("builder", builder); binding.setVariable("lineNumber", lineNumber); binding.setVariable("fileName", fileName); return runScript(); } return Optional.empty(); } }
GroovyExpressionMatcher implements Serializable { public Object run(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName) { if (compileScriptIfNotYetDone()) { Binding binding = compiled.getBinding(); binding.setVariable("matcher", matcher); binding.setVariable("builder", builder); binding.setVariable("lineNumber", lineNumber); binding.setVariable("fileName", fileName); return runScript(); } return Optional.empty(); } GroovyExpressionMatcher(final String script); }
GroovyExpressionMatcher implements Serializable { public Object run(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName) { if (compileScriptIfNotYetDone()) { Binding binding = compiled.getBinding(); binding.setVariable("matcher", matcher); binding.setVariable("builder", builder); binding.setVariable("lineNumber", lineNumber); binding.setVariable("fileName", fileName); return runScript(); } 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 { public Object run(final Matcher matcher, final IssueBuilder builder, final int lineNumber, final String fileName) { if (compileScriptIfNotYetDone()) { Binding binding = compiled.getBinding(); binding.setVariable("matcher", matcher); binding.setVariable("builder", builder); binding.setVariable("lineNumber", lineNumber); binding.setVariable("fileName", fileName); return runScript(); } 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);  }