Skip to content

Commit

Permalink
Adapt tests to credentials plugin 1378.v81ef4269d764
Browse files Browse the repository at this point in the history
https://github.com/jenkinsci/credentials-plugin/releases/tag/1378.v81ef4269d764
includes the change to throw a FormException from the
UsernamePasswordCredentialsImpl constructor.  Change included in:

* jenkinsci/credentials-plugin#558
  • Loading branch information
MarkEWaite committed Sep 28, 2024
1 parent aeb80c4 commit a0e7594
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.cloudbees.plugins.credentials.common.StandardCredentials;
import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials;
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
import hudson.model.Descriptor.FormException;
import hudson.model.Fingerprint;
import hudson.util.LogTaskListener;
import java.io.File;
Expand Down Expand Up @@ -137,7 +138,7 @@ public CredentialsTest(
}

@Before
public void setUp() throws IOException, InterruptedException {
public void setUp() throws FormException, IOException, InterruptedException {
git = null;
repo = tempFolder.newFolder();
/* Use a repo with a special character in name - JENKINS-43931 */
Expand Down Expand Up @@ -212,7 +213,8 @@ private BasicSSHUserPrivateKey newPrivateKeyCredential(String username, File pri
return new BasicSSHUserPrivateKey(scope, id, username, privateKeySource, this.passphrase, description);
}

private StandardUsernamePasswordCredentials newUsernamePasswordCredential(String username, String password) {
private StandardUsernamePasswordCredentials newUsernamePasswordCredential(String username, String password)
throws FormException {
CredentialsScope scope = CredentialsScope.GLOBAL;
String id = "username-" + username + "-password-" + password + random.nextInt();
return new UsernamePasswordCredentialsImpl(scope, id, "desc: " + id, username, password);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void testClearCredentials() {
}

@Test
public void testAddCredentials() {
public void testAddCredentials() throws Exception {
CredentialsScope scope = CredentialsScope.GLOBAL;
String password = "password";
String url = "https://github.com/jenkinsci/git-client-plugin";
Expand All @@ -99,7 +99,7 @@ public void testAddCredentials() {
}

@Test
public void testSetCredentials() {
public void testSetCredentials() throws Exception {
CredentialsScope scope = CredentialsScope.GLOBAL;
String password = "password";
String username = "user";
Expand All @@ -110,7 +110,7 @@ public void testSetCredentials() {
}

@Test
public void testAddDefaultCredentials() {
public void testAddDefaultCredentials() throws Exception {
CredentialsScope scope = CredentialsScope.GLOBAL;
String password = "password";
String username = "user";
Expand Down

0 comments on commit a0e7594

Please sign in to comment.