diff --git a/src/test/java/org/jvnet/hudson/plugins/groovypostbuild/GroovyPostbuildRecorderTest.java b/src/test/java/org/jvnet/hudson/plugins/groovypostbuild/GroovyPostbuildRecorderTest.java index e014775..4137f1b 100644 --- a/src/test/java/org/jvnet/hudson/plugins/groovypostbuild/GroovyPostbuildRecorderTest.java +++ b/src/test/java/org/jvnet/hudson/plugins/groovypostbuild/GroovyPostbuildRecorderTest.java @@ -43,6 +43,7 @@ import hudson.model.Item; import hudson.model.Result; import hudson.model.User; +import hudson.util.VersionNumber; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -478,7 +479,15 @@ public void testBadgeMigration() throws Exception { BadgeSummaryAction badgeSummaryAction = b.getAction(BadgeSummaryAction.class); assertNotNull(badgeSummaryAction); - assertEquals("/plugin/badge/images/info.gif", badgeSummaryAction.getIcon()); + + VersionNumber badgePluginVersion = + j.getPluginManager().getPlugin("badge").getVersionNumber(); + + if (badgePluginVersion.isNewerThanOrEqualTo(new VersionNumber("2.5"))) { + assertEquals("symbol-information-circle", badgeSummaryAction.getIcon()); + } else { + assertEquals("/plugin/badge/images/info.gif", badgeSummaryAction.getIcon()); + } assertEquals("summaryText", badgeSummaryAction.getText()); } @@ -487,15 +496,28 @@ public void testBadgeMigration() throws Exception { FreeStyleBuild b = j.assertBuildStatusSuccess(p.scheduleBuild2(0)); assertNotNull(b); + VersionNumber badgePluginVersion = + j.getPluginManager().getPlugin("badge").getVersionNumber(); + BadgeAction badgeAction = b.getAction(BadgeAction.class); assertNotNull(badgeAction); - assertEquals("/plugin/badge/images/success.gif", badgeAction.getIcon()); + + if (badgePluginVersion.isNewerThanOrEqualTo(new VersionNumber("2.5"))) { + assertEquals("symbol-status-blue", badgeAction.getIcon()); + } else { + assertEquals("/plugin/badge/images/success.gif", badgeAction.getIcon()); + } assertEquals("shortText", badgeAction.getText()); assertEquals("https://jenkins.io/", badgeAction.getLink()); BadgeSummaryAction badgeSummaryAction = b.getAction(BadgeSummaryAction.class); assertNotNull(badgeSummaryAction); - assertEquals("/plugin/badge/images/info.gif", badgeSummaryAction.getIcon()); + + if (badgePluginVersion.isNewerThanOrEqualTo(new VersionNumber("2.5"))) { + assertEquals("symbol-information-circle", badgeSummaryAction.getIcon()); + } else { + assertEquals("/plugin/badge/images/info.gif", badgeSummaryAction.getIcon()); + } assertEquals("summaryText", badgeSummaryAction.getText()); } }