diff --git a/src/test/java/org/jenkinsci/plugins/badge/dsl/AddEmbeddableBadgeConfigStepTest.java b/src/test/java/org/jenkinsci/plugins/badge/dsl/AddEmbeddableBadgeConfigStepTest.java index 11ffce4e9..01bf0abae 100644 --- a/src/test/java/org/jenkinsci/plugins/badge/dsl/AddEmbeddableBadgeConfigStepTest.java +++ b/src/test/java/org/jenkinsci/plugins/badge/dsl/AddEmbeddableBadgeConfigStepTest.java @@ -1,28 +1,64 @@ package org.jenkinsci.plugins.badge.dsl; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNull.nullValue; +import static org.junit.jupiter.api.Assertions.*; -import org.junit.Test; +import hudson.model.TaskListener; +import org.junit.jupiter.api.Test; + +class AddEmbeddableBadgeConfigStepTest { + + @Test + void testConstructorAndGetID() { + AddEmbeddableBadgeConfigStep step = new AddEmbeddableBadgeConfigStep("testId"); + assertEquals("testId", step.getID()); + } + + @Test + void testGetSubjectAndSetSubject() { + AddEmbeddableBadgeConfigStep step = new AddEmbeddableBadgeConfigStep("testId"); + assertNull(step.getSubject()); + step.setSubject("testSubject"); + assertEquals("testSubject", step.getSubject()); + } + + @Test + void testGetStatusAndSetStatus() { + AddEmbeddableBadgeConfigStep step = new AddEmbeddableBadgeConfigStep("testId"); + assertNull(step.getStatus()); + step.setStatus("testStatus"); + assertEquals("testStatus", step.getStatus()); + } + + @Test + void testGetColorAndSetColor() { + AddEmbeddableBadgeConfigStep step = new AddEmbeddableBadgeConfigStep("testId"); + assertNull(step.getColor()); + step.setColor("testColor"); + assertEquals("testColor", step.getColor()); + } + + @Test + void testGetAnimatedOverlayColorAndSetAnimatedOverlayColor() { + AddEmbeddableBadgeConfigStep step = new AddEmbeddableBadgeConfigStep("testId"); + assertNull(step.getAnimatedOverlayColor()); + step.setAnimatedOverlayColor("testOverlayColor"); + assertEquals("testOverlayColor", step.getAnimatedOverlayColor()); + } -public class AddEmbeddableBadgeConfigStepTest { @Test - public void testConstructor() { - AddEmbeddableBadgeConfigStep addEmbeddableBadgeConfigStep = - new AddEmbeddableBadgeConfigStep("test-Id-constructor"); - assertThat(addEmbeddableBadgeConfigStep.getID(), is("test-Id-constructor")); - assertThat(addEmbeddableBadgeConfigStep.getSubject(), is(nullValue())); - assertThat(addEmbeddableBadgeConfigStep.getStatus(), is(nullValue())); - assertThat(addEmbeddableBadgeConfigStep.getColor(), is(nullValue())); - assertThat(addEmbeddableBadgeConfigStep.getAnimatedOverlayColor(), is(nullValue())); - assertThat(addEmbeddableBadgeConfigStep.getLink(), is(nullValue())); + void testGetLinkAndSetLink() { + AddEmbeddableBadgeConfigStep step = new AddEmbeddableBadgeConfigStep("testId"); + assertNull(step.getLink()); + step.setLink("testLink"); + assertEquals("testLink", step.getLink()); } @Test - public void testGetAnimatedOverlayColor() { - AddEmbeddableBadgeConfigStep addEmbeddableBadgeConfigStep = - new AddEmbeddableBadgeConfigStep("test-animated-overlay-color"); - assertThat(addEmbeddableBadgeConfigStep.getColor(), is(nullValue())); + void testDescriptor() { + AddEmbeddableBadgeConfigStep.DescriptorImpl descriptor = new AddEmbeddableBadgeConfigStep.DescriptorImpl(); + assertEquals("addEmbeddableBadgeConfiguration", descriptor.getFunctionName()); + assertEquals("Add an Embeddable Badge Configuration", descriptor.getDisplayName()); + assertEquals(1, descriptor.getRequiredContext().size()); + assertTrue(descriptor.getRequiredContext().contains(TaskListener.class)); } }