Skip to content

Commit

Permalink
Test null name and empty name
Browse files Browse the repository at this point in the history
Does not assert on contents of the log message because I could not
deduce how to use LoggerRule to capture the message that was being
logged.
  • Loading branch information
MarkEWaite committed Sep 3, 2023
1 parent 4a51155 commit 768da66
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;

/**
Expand All @@ -48,6 +49,22 @@ public void testConstructor_0_10_2() {
null); // dockerHostname
}

@Issue("JENKINS-70729") // Warn if cloud name is empty
@Test
public void testConstructorWithEmptyName() {
DockerCloud cloud =
new DockerCloud("", new DockerAPI(new DockerServerEndpoint("uri", "credentialsId")), List.of());
Assert.assertEquals(cloud.getDisplayName(), "");
}

@Issue("JENKINS-70729") // Warn if cloud name is null
@Test
public void testConstructorWithNullName() {
DockerCloud cloud =
new DockerCloud(null, new DockerAPI(new DockerServerEndpoint("uri", "credentialsId")), List.of());
Assert.assertEquals(cloud.getDisplayName(), null);
}

@Test
public void globalConfigRoundtrip() throws Exception {

Expand Down

0 comments on commit 768da66

Please sign in to comment.