Search in sources :

Example 1 with HtmlBadgeAction

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

the class AddHtmlBadgeStepTest method addHtmlBadge.

@Test
public void addHtmlBadge() throws Exception {
    String html = UUID.randomUUID().toString();
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    String script = "addHtmlBadge(\"" + html + "\")";
    p.setDefinition(new CpsFlowDefinition(script, true));
    WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
    List<BuildBadgeAction> badgeActions = b.getBadgeActions();
    assertEquals(1, badgeActions.size());
    HtmlBadgeAction action = (HtmlBadgeAction) badgeActions.get(0);
    assertEquals(html, action.getHtml());
}
Also used : CpsFlowDefinition(org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition) BuildBadgeAction(hudson.model.BuildBadgeAction) HtmlBadgeAction(com.jenkinsci.plugins.badge.action.HtmlBadgeAction) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) WorkflowRun(org.jenkinsci.plugins.workflow.job.WorkflowRun) Test(org.junit.Test)

Aggregations

HtmlBadgeAction (com.jenkinsci.plugins.badge.action.HtmlBadgeAction)1 BuildBadgeAction (hudson.model.BuildBadgeAction)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 Test (org.junit.Test)1