From d01156fc5137ae0bad13a874563f1c045a823bc8 Mon Sep 17 00:00:00 2001 From: Yaroslav Afenkin Date: Mon, 4 Mar 2024 17:49:04 +0200 Subject: [PATCH] [JENKINS-72611] Do not update credentials ID in `BaseTest` --- .../org/jenkinsci/plugins/plaincredentials/BaseTest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/jenkinsci/plugins/plaincredentials/BaseTest.java b/src/test/java/org/jenkinsci/plugins/plaincredentials/BaseTest.java index 5a3c3a1..8af6658 100644 --- a/src/test/java/org/jenkinsci/plugins/plaincredentials/BaseTest.java +++ b/src/test/java/org/jenkinsci/plugins/plaincredentials/BaseTest.java @@ -34,7 +34,6 @@ public class BaseTest { - private static final String UPDATED_CRED_ID = "Custom-ID-Updated"; private static final String CRED_ID = "Custom-ID"; @Rule @@ -50,7 +49,7 @@ public void setup(){ @Test public void secretTextBaseTest() throws IOException { StringCredentialsImpl credential = new StringCredentialsImpl(CredentialsScope.GLOBAL, CRED_ID, "Test Secret Text", Secret.fromString("password")); - StringCredentialsImpl updatedCredential = new StringCredentialsImpl(credential.getScope(), UPDATED_CRED_ID, credential.getDescription(), credential.getSecret()); + StringCredentialsImpl updatedCredential = new StringCredentialsImpl(credential.getScope(), CRED_ID, credential.getDescription(), credential.getSecret()); testCreateUpdateDelete(credential, updatedCredential); } @@ -75,7 +74,7 @@ private void secretFileTest(boolean useDeprecatedConstructor) throws IOException credential = new FileCredentialsImpl(CredentialsScope.GLOBAL, CRED_ID, "Test Secret file", fileItem, "keys.txt", SecretBytes.fromBytes(fileItem.get())); } - FileCredentialsImpl updatedCredential = new FileCredentialsImpl(credential.getScope(), UPDATED_CRED_ID, credential.getDescription(), fileItem, credential.getFileName(), credential.getSecretBytes()); + FileCredentialsImpl updatedCredential = new FileCredentialsImpl(credential.getScope(), CRED_ID, credential.getDescription(), fileItem, credential.getFileName(), credential.getSecretBytes()); testCreateUpdateDelete(credential, updatedCredential); } @@ -108,7 +107,7 @@ private void testCreateUpdateDelete(T creden assertThat(credentials.size(), is(1)); cred = credentials.get(0); assertThat(cred, instanceOf(credential.getClass())); - assertThat(cred.getId(), is(UPDATED_CRED_ID)); + assertThat(cred.getId(), is(CRED_ID)); // Delete credential store.removeCredentials(Domain.global(), cred);