Skip to content

Commit

Permalink
Provide a copy button for link examples (#222)
Browse files Browse the repository at this point in the history
Use a more modern page layout with jelly instead of groovy layout.  Provide a copy button rather than using a borderless input field to provide easy copy and paste.  The copy button is used in multiple places in Jenkins.

Fix Bitbucket URL link error (Had unbalanced parentheses)

Add Asciidoc examples

Fixes #59
MarkEWaite authored Aug 2, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 5999f58 commit 09dadb1
Showing 8 changed files with 570 additions and 228 deletions.
Original file line number Diff line number Diff line change
@@ -8,10 +8,14 @@
import hudson.model.Action;
import hudson.model.Job;
import hudson.model.Run;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import org.jenkins.ui.icon.IconSpec;
import org.jenkinsci.plugins.badge.*;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.WebMethod;

/**
@@ -45,6 +49,31 @@ public String getUrlName() {
return "badge";
}

public String getUrl() {
/* Needed for the jelly syntax hints page */
String url = "";
StaplerRequest req = Stapler.getCurrentRequest();
if (req != null) {
url = req.getReferer();
if (url == null) {
url = "null-referer";
}
}
return url;
}

public String getUrlEncodedFullName() {
/* Needed for the jelly syntax hints page */
if (project == null) {
return "null-project-no-url-encoded-fullName";
}
if (project.getFullName() == null) {
return "null-project-fullName-no-url-encoded-fullName";
}
String fullName = URLEncoder.encode(project.getFullName(), StandardCharsets.UTF_8);
return fullName == null ? "null-url-encoded-fullName" : fullName;
}

@WebMethod(name = "icon")
public HttpResponse doIcon(
@QueryParameter String build,
Original file line number Diff line number Diff line change
@@ -7,10 +7,13 @@
import hudson.model.Action;
import hudson.model.Job;
import hudson.model.Run;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import org.jenkins.ui.icon.IconSpec;
import org.jenkinsci.plugins.badge.*;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.WebMethod;

public class RunBadgeAction implements Action, IconSpec {
@@ -42,6 +45,26 @@ public String getUrlName() {
return "badge";
}

public String getUrl() {
/* TODO: Is a permission check needed here? */
/* Needed for the jelly syntax hints page */
String url = Stapler.getCurrentRequest().getReferer();
return url == null ? "null-referer" : url;
}

public String getUrlEncodedFullName() {
/* TODO: Is a permission check needed here? */
/* Needed for the jelly syntax hints page */
if (project == null) {
return "null-project-no-url-encoded-fullName";
}
if (project.getFullName() == null) {
return "null-project-fullName-no-url-encoded-fullName";
}
String fullName = URLEncoder.encode(project.getFullName(), StandardCharsets.UTF_8);
return fullName == null ? "null-url-encoded-fullName" : fullName;
}

@WebMethod(name = "icon")
public HttpResponse doIcon(
@QueryParameter String style,

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">

<j:set var="fullJobName" value="${it.urlEncodedFullName}"/>
<j:set var="jobUrl" value="${it.url}"/>
<j:set var="badgeUrl" value="${jobUrl}badge/icon"/>
<j:set var="textUrl" value="${jobUrl}badge/text"/>
<j:set var="publicBadge" value="${app.rootUrl}buildStatus/icon?job=${fullJobName}"/>
<j:set var="publicText" value="${app.rootUrl}buildStatus/text?job=${fullJobName}"/>

<l:layout title="${%Embeddable Build Status Icon}" type="one-column">
<l:header>
<link rel='stylesheet' href='${app.rootUrl}/plugin/embeddable-build-status/css/design.css' type='text/css'/>
</l:header>
<l:main-panel>
<h1>${%Embeddable Build Status Icon}</h1>
<p>${%blurb}</p>

<h2>${%Examples}</h2>
<small>${%examples_note}</small>

<j:set var="flatCustomSubjectUrl" value="${badgeUrl}?subject=Custom%20Subject&amp;status=Any%20State&amp;color=darkturquoise"/>

<h3 class="help-format">${%flat}</h3>
<img id='${badgeUrl}' src='${badgeUrl}' title='${badgeUrl}'/>
<br/>
<img id='${badgeUrl}-custom' src='${flatCustomSubjectUrl}' title='${flatCustomSubjectUrl}'/>

<j:set var="flatSquareUrl" value="${badgeUrl}?style=flat-square"/>
<j:set var="flatSquareCustomSubjectUrl" value="${badgeUrl}?style=flat-square&amp;subject=Custom%20Subject&amp;status=Any%20State&amp;color=darkturquoise"/>

<h3 class="help-format">${%flat-square}</h3>
<img src='${flatSquareUrl}' title='${flatSquareUrl}'/>
<br/>
<img src='${flatSquareCustomSubjectUrl}' title='${flatSquareCustomSubjectUrl}'/>

<j:set var="plasticUrl" value="${badgeUrl}?style=plastic"/>
<j:set var="plasticCustomSubjectUrl" value="${badgeUrl}?style=plastic&amp;subject=Custom%20Subject&amp;status=Any%20State&amp;color=darkturquoise"/>

<h3 class="help-format">${%plastic}</h3>
<img src='${plasticUrl}' title='${plasticUrl}'/>
<br/>
<img src='${plasticCustomSubjectUrl}' title='${plasticCustomSubjectUrl}'/>

<j:set var="ball16Url" value="${badgeUrl}?style=ball-16x16"/>
<j:set var="ball32Url" value="${badgeUrl}?style=ball-32x32"/>

<h3 class="help-format">${%ball-size}</h3>
<img src='${ball16Url}' title='${ball16Url}'/>
<br/>
<img src='${ball32Url}' title='${ball32Url}'/>

<h2>${%Links}</h2>

<h3 class="help-format">${%Plain link}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${badgeUrl}"/>
<br/>
${badgeUrl}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${publicBadge}"/>
<br/>
${publicBadge}
</p>

<j:set var="markdownProtectedLink" value="[![Build Status](${badgeUrl})](${jobUrl})"/>
<j:set var="markdownUnprotectedLink" value="[![Build Status](${publicBadge})](${jobUrl})"/>

<h3 class="help-format">${%Markdown}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${markdownProtectedLink}"/>
<br/>
${markdownProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${markdownUnprotectedLink}"/>
<br/>
${markdownUnprotectedLink}
</p>

<j:set var="htmlProtectedLink" value="&lt;a href='${jobUrl}'&gt;&lt;img src='${badgeUrl}'&gt;&lt;/a&gt;"/>
<j:set var="htmlUnprotectedLink" value="&lt;a href='${jobUrl}'&gt;&lt;img src='${publicBadge}'&gt;&lt;/a&gt;"/>

<h3 class="help-format">${%HTML}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${htmlProtectedLink}"/>
<br/>
${htmlProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${htmlUnprotectedLink}"/>
<br/>
${htmlUnprotectedLink}
</p>

<j:set var="asciidocProtectedLink" value="image:${badgeUrl}[link='${jobUrl}']"/>
<j:set var="asciidocUnprotectedLink" value="image:${publicBadge})[link='${jobUrl}']"/>

<h3 class="help-format">${%Asciidoc}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${asciidocProtectedLink}"/>
<br/>
${asciidocProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${asciidocUnprotectedLink}"/>
<br/>
${asciidocUnprotectedLink}
</p>

<j:set var="confluenceProtectedLink" value="[!${badgeUrl}!|${jobUrl}]"/>
<j:set var="confluenceUnprotectedLink" value="[!${publicBadge}!|${jobUrl}]"/>

<h3 class="help-format">${%Confluence}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${confluenceProtectedLink}"/>
<br/>
${confluenceProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${confluenceUnprotectedLink}"/>
<br/>
${confluenceUnprotectedLink}
</p>

<j:set var="xwikiProtectedLink" value="[[image:${badgeUrl}>>${jobUrl}||target='__new']]"/>
<j:set var="xwikiUnprotectedLink" value="[[image:${publicBadge}>>${jobUrl}||target='__new']]"/>

<h3 class="help-format">${%XWiki}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${xwikiProtectedLink}"/>
<br/>
${xwikiProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${xwikiUnprotectedLink}"/>
<br/>
${xwikiUnprotectedLink}
</p>

<j:set var="rdocProtectedLink" value="{&lt;img src='${badgeUrl}'/&gt;}[${jobUrl}]"/>
<j:set var="rdocUnprotectedLink" value="{&lt;img src='${publicBadge}'/&gt;}[${jobUrl}]"/>

<h3 class="help-format">${%RDoc}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${rdocProtectedLink}"/>
<br/>
${rdocProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${rdocUnprotectedLink}"/>
<br/>
${rdocUnprotectedLink}
</p>

<j:set var="textileProtectedLink" value="&quot;!${badgeUrl}!&quot;:${jobUrl}"/>
<j:set var="textileUnprotectedLink" value="&quot;!${publicBadge}!&quot;:${jobUrl}"/>

<h3 class="help-format">${%Textile}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${textileProtectedLink}"/>
<br/>
${textileProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${textileUnprotectedLink}"/>
<br/>
${textileUnprotectedLink}
</p>

<j:set var="bitbucketProtectedLink" value="[Build Status](${badgeUrl} &quot;${jobUrl}&quot;)"/>
<j:set var="bitbucketUnprotectedLink" value="[Build Status](${publicBadge} &quot;${jobUrl}&quot;)"/>

<h3 class="help-format">${%Bitbucket}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${bitbucketProtectedLink}"/>
<br/>
${bitbucketProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${bitbucketUnprotectedLink}"/>
<br/>
${bitbucketUnprotectedLink}
</p>

<h2>${%Embeddable Build Status Text}</h2>
<p>${%blurb_text}</p>

<h3 class="help-format">${%Text Only}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${textUrl}"/>
<br/>
${textUrl}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${publicText}"/>
<br/>
${publicText}
</p>

</l:main-panel>
</l:layout>
</j:jelly>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">

<j:set var="fullJobName" value="${it.urlEncodedFullName}"/>
<j:set var="jobUrl" value="${it.url}"/>
<j:set var="badgeUrl" value="${jobUrl}badge/icon"/>
<j:set var="textUrl" value="${jobUrl}badge/text"/>
<j:set var="publicBadge" value="${app.rootUrl}buildStatus/icon?job=${fullJobName}&amp;build=${it.run.number}"/>
<j:set var="publicText" value="${app.rootUrl}buildStatus/text?job=${fullJobName}&amp;build=${it.run.number}"/>

<l:layout title="${%Embeddable Build Status Icon}" type="one-column">
<l:header>
<link rel='stylesheet' href='${app.rootUrl}/plugin/embeddable-build-status/css/design.css' type='text/css'/>
</l:header>
<l:main-panel>
<h1>${%Embeddable Build Status Icon}</h1>
<p>${%blurb}</p>

<h2>${%Examples}</h2>
<small>${%examples_note}</small>

<j:set var="flatCustomSubjectUrl" value="${badgeUrl}?subject=Custom%20Subject&amp;status=Any%20State&amp;color=darkturquoise"/>

<h3 class="help-format">${%flat}</h3>
<img id='${badgeUrl}' src='${badgeUrl}' title='${badgeUrl}'/>
<br/>
<img id='${badgeUrl}-custom' src='${flatCustomSubjectUrl}' title='${flatCustomSubjectUrl}'/>

<j:set var="flatSquareUrl" value="${badgeUrl}?style=flat-square"/>
<j:set var="flatSquareCustomSubjectUrl" value="${badgeUrl}?style=flat-square&amp;subject=Custom%20Subject&amp;status=Any%20State&amp;color=darkturquoise"/>

<h3 class="help-format">${%flat-square}</h3>
<img src='${flatSquareUrl}' title='${flatSquareUrl}'/>
<br/>
<img src='${flatSquareCustomSubjectUrl}' title='${flatSquareCustomSubjectUrl}'/>

<j:set var="plasticUrl" value="${badgeUrl}?style=plastic"/>
<j:set var="plasticCustomSubjectUrl" value="${badgeUrl}?style=plastic&amp;subject=Custom%20Subject&amp;status=Any%20State&amp;color=darkturquoise"/>

<h3 class="help-format">${%plastic}</h3>
<img src='${plasticUrl}' title='${plasticUrl}'/>
<br/>
<img src='${plasticCustomSubjectUrl}' title='${plasticCustomSubjectUrl}'/>

<j:set var="ball16Url" value="${badgeUrl}?style=ball-16x16"/>
<j:set var="ball32Url" value="${badgeUrl}?style=ball-32x32"/>

<h3 class="help-format">${%ball-size}</h3>
<img src='${ball16Url}' title='${ball16Url}'/>
<br/>
<img src='${ball32Url}' title='${ball32Url}'/>

<h2>${%Links}</h2>

<h3 class="help-format">${%Plain link}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${badgeUrl}"/>
<br/>
${badgeUrl}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${publicBadge}"/>
<br/>
${publicBadge}
</p>

<j:set var="markdownProtectedLink" value="[![Build Status](${badgeUrl})](${jobUrl})"/>
<j:set var="markdownUnprotectedLink" value="[![Build Status](${publicBadge})](${jobUrl})"/>

<h3 class="help-format">${%Markdown}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${markdownProtectedLink}"/>
<br/>
${markdownProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${markdownUnprotectedLink}"/>
<br/>
${markdownUnprotectedLink}
</p>

<j:set var="htmlProtectedLink" value="&lt;a href='${jobUrl}'&gt;&lt;img src='${badgeUrl}'&gt;&lt;/a&gt;"/>
<j:set var="htmlUnprotectedLink" value="&lt;a href='${jobUrl}'&gt;&lt;img src='${publicBadge}'&gt;&lt;/a&gt;"/>

<h3 class="help-format">${%HTML}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${htmlProtectedLink}"/>
<br/>
${htmlProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${htmlUnprotectedLink}"/>
<br/>
${htmlUnprotectedLink}
</p>

<j:set var="asciidocProtectedLink" value="image:${badgeUrl}[link='${jobUrl}']"/>
<j:set var="asciidocUnprotectedLink" value="image:${publicBadge})[link='${jobUrl}']"/>

<h3 class="help-format">${%Asciidoc}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${asciidocProtectedLink}"/>
<br/>
${asciidocProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${asciidocUnprotectedLink}"/>
<br/>
${asciidocUnprotectedLink}
</p>

<j:set var="confluenceProtectedLink" value="[!${badgeUrl}!|${jobUrl}]"/>
<j:set var="confluenceUnprotectedLink" value="[!${publicBadge}!|${jobUrl}]"/>

<h3 class="help-format">${%Confluence}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${confluenceProtectedLink}"/>
<br/>
${confluenceProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${confluenceUnprotectedLink}"/>
<br/>
${confluenceUnprotectedLink}
</p>

<j:set var="xwikiProtectedLink" value="[[image:${badgeUrl}>>${jobUrl}||target='__new']]"/>
<j:set var="xwikiUnprotectedLink" value="[[image:${publicBadge}>>${jobUrl}||target='__new']]"/>

<h3 class="help-format">${%XWiki}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${xwikiProtectedLink}"/>
<br/>
${xwikiProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${xwikiUnprotectedLink}"/>
<br/>
${xwikiUnprotectedLink}
</p>

<j:set var="rdocProtectedLink" value="{&lt;img src='${badgeUrl}'/&gt;}[${jobUrl}]"/>
<j:set var="rdocUnprotectedLink" value="{&lt;img src='${publicBadge}'/&gt;}[${jobUrl}]"/>

<h3 class="help-format">${%RDoc}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${rdocProtectedLink}"/>
<br/>
${rdocProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${rdocUnprotectedLink}"/>
<br/>
${rdocUnprotectedLink}
</p>

<j:set var="textileProtectedLink" value="&quot;!${badgeUrl}!&quot;:${jobUrl}"/>
<j:set var="textileUnprotectedLink" value="&quot;!${publicBadge}!&quot;:${jobUrl}"/>

<h3 class="help-format">${%Textile}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${textileProtectedLink}"/>
<br/>
${textileProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${textileUnprotectedLink}"/>
<br/>
${textileUnprotectedLink}
</p>

<j:set var="bitbucketProtectedLink" value="[Build Status](${badgeUrl} &quot;${jobUrl}&quot;)"/>
<j:set var="bitbucketUnprotectedLink" value="[Build Status](${publicBadge} &quot;${jobUrl}&quot;)"/>

<h3 class="help-format">${%Bitbucket}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${bitbucketProtectedLink}"/>
<br/>
${bitbucketProtectedLink}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${bitbucketUnprotectedLink}"/>
<br/>
${bitbucketUnprotectedLink}
</p>

<h2>${%Embeddable Build Status Text}</h2>
<p>${%blurb_text}</p>

<h3 class="help-format">${%Text Only}</h3>
<p>
<b>${%Protected}</b> <l:copyButton text="${textUrl}"/>
<br/>
${textUrl}
</p>
<p>
<b>${%Unprotected}</b> <l:copyButton text="${publicText}"/>
<br/>
${publicText}
</p>

</l:main-panel>
</l:layout>
</j:jelly>
8 changes: 7 additions & 1 deletion src/main/webapp/css/design.css
Original file line number Diff line number Diff line change
@@ -9,6 +9,12 @@ INPUT.select-all {
IMG#badge {
margin-left:2em;
}
h3 {
h2 {
margin-bottom: 1px;
margin-top: 1em;
}
h3.help-format {
border-bottom: 1px solid grey;
margin-bottom: 1px;
margin-top: 1em;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* The MIT License
*
* Copyright 2023 Mark Waite.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkinsci.plugins.badge.actions;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

import hudson.model.FreeStyleProject;
import hudson.model.Result;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;

public class JobBadgeActionTest {

@ClassRule
public static JenkinsRule j = new JenkinsRule();

private static final String NOT_BUILT_JOB_NAME = "not-built-job";
private static JobBadgeAction notBuiltAction;

private static final String SUCCESSFUL_JOB_NAME = "successful-job";
private static JobBadgeAction successfulAction;

public JobBadgeActionTest() {}

@BeforeClass
public static void createAction() throws Exception {
/* Build a job for assertions on successful jobs */
FreeStyleProject successfulJob = j.createFreeStyleProject(SUCCESSFUL_JOB_NAME);
j.buildAndAssertStatus(Result.SUCCESS, successfulJob);
successfulAction = new JobBadgeAction(successfulJob);

/* Define a job and do not build it for assertions on jobs that have not been built */
FreeStyleProject notBuiltJob = j.createFreeStyleProject(NOT_BUILT_JOB_NAME);
notBuiltAction = new JobBadgeAction(notBuiltJob);
}

@Test
public void testGetIconFileName() {
assertThat(notBuiltAction.getIconFileName(), is(nullValue()));
assertThat(successfulAction.getIconFileName(), is(nullValue()));
}

@Test
public void testGetIconClassName() {
assertThat(notBuiltAction.getIconClassName(), is("symbol-shield-outline plugin-ionicons-api"));
assertThat(successfulAction.getIconClassName(), is("symbol-shield-outline plugin-ionicons-api"));
}

@Test
public void testGetDisplayName() {
assertThat(notBuiltAction.getDisplayName(), is("Embeddable Build Status"));
assertThat(successfulAction.getDisplayName(), is("Embeddable Build Status"));
}

@Test
public void testGetUrlName() {
assertThat(notBuiltAction.getUrlName(), is("badge"));
assertThat(successfulAction.getUrlName(), is("badge"));
}

@Test
public void testGetUrl() {
assertThat(notBuiltAction.getUrl(), is(""));
assertThat(successfulAction.getUrl(), is(""));
}

@Test
public void testGetUrlEncodedFullName() {
assertThat(notBuiltAction.getUrlEncodedFullName(), is(NOT_BUILT_JOB_NAME));
assertThat(successfulAction.getUrlEncodedFullName(), is(SUCCESSFUL_JOB_NAME));
}

@Test
public void testDoText() {
assertThat(notBuiltAction.doText(), is("Not built"));
assertThat(successfulAction.doText(), is("Success"));
}
}

0 comments on commit 09dadb1

Please sign in to comment.