Search in sources :

Example 1 with AbstractBadgeAction

use of com.jenkinsci.plugins.badge.action.AbstractBadgeAction in project badge-plugin by jenkinsci.

the class RemoveBadgesStepTest method removeBadges.

private void removeBadges(String badgeScriptPrefix, String removeScript, String... remainingBadgeIds) throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    String script = badgeScriptPrefix + ", id: 'a')\n" + badgeScriptPrefix + ", id: 'b')\n" + removeScript;
    p.setDefinition(new CpsFlowDefinition(script, true));
    WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
    List<AbstractBadgeAction> badgeActions = b.getActions(AbstractBadgeAction.class);
    assertEquals(remainingBadgeIds.length, badgeActions.size());
    for (int i = 0; i < remainingBadgeIds.length; i++) {
        assertEquals(remainingBadgeIds[i], badgeActions.get(i).getId());
    }
}
Also used : CpsFlowDefinition(org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition) AbstractBadgeAction(com.jenkinsci.plugins.badge.action.AbstractBadgeAction) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) WorkflowRun(org.jenkinsci.plugins.workflow.job.WorkflowRun)

Aggregations

AbstractBadgeAction (com.jenkinsci.plugins.badge.action.AbstractBadgeAction)1 CpsFlowDefinition (org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition)1 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)1 WorkflowRun (org.jenkinsci.plugins.workflow.job.WorkflowRun)1