IssuesSizeTokenMacro extends DataBoundTokenMacro { @Parameter public void setTool(final String tool) { this.tool = tool; }  @Parameter void setTool(final String tool); @Parameter void setType(final String type); @Override boolean acceptsMacroName(final String macroName); @Override String evaluate(final AbstractBuild<?, ?> abstractBuild, final TaskListener taskListener,
            final String macroName); @Override String evaluate(final Run<?, ?> run, final FilePath workspace, final TaskListener listener,
            final String macroName);  }
@Test void shouldReturnZeroIfNoActionPresent() { IssuesSizeTokenMacro macro = new IssuesSizeTokenMacro(); Run<?, ?> run = createBuildWithActions(); assertThat(expandMacro(macro, run)).isEqualTo("0"); macro.setTool("id"); assertThat(expandMacro(macro, run)).isEqualTo("0"); }
@Test void shouldExpandTokenOfSingleAction() { IssuesSizeTokenMacro macro = new IssuesSizeTokenMacro(); Run<?, ?> run = createBuildWithActions(createAction("id", "name", 1)); assertThat(expandMacro(macro, run)).isEqualTo("1"); macro.setTool("id"); assertThat(expandMacro(macro, run)).isEqualTo("1"); macro.setTool("other"); assertThat(expandMacro(macro, run)).isEqualTo("0"); }
@Test void shouldExpandTokenOfTwoActions() { IssuesSizeTokenMacro macro = new IssuesSizeTokenMacro(); Run<?, ?> run = createBuildWithActions( createAction("first", "first name", 1), createAction("second", "second name", 2)); assertThat(expandMacro(macro, run)).isEqualTo("3"); macro.setTool("first"); assertThat(expandMacro(macro, run)).isEqualTo("1"); macro.setTool("second"); assertThat(expandMacro(macro, run)).isEqualTo("2"); macro.setTool("other"); assertThat(expandMacro(macro, run)).isEqualTo("0"); }