From 9fcb622a986e9b8110cccf1be0467cd43a8f58dc Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Thu, 29 Apr 2021 11:26:05 +0200 Subject: SONAR-14320 Fix unit test --- .../server/authentication/CredentialsLocalAuthenticationTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'server/sonar-webserver-auth/src') diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsLocalAuthenticationTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsLocalAuthenticationTest.java index 7cac4072035..2d7ab741fb3 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsLocalAuthenticationTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsLocalAuthenticationTest.java @@ -310,9 +310,13 @@ public class CredentialsLocalAuthenticationTest { .setCryptedPassword(DigestUtils.sha1Hex("--" + salt + "--" + password + "--")) .setSalt(salt); + assertThatThrownBy(() -> underTest.authenticate(dbSession, userInvalidHash, "WHATEVER", AuthenticationEvent.Method.BASIC)) + .isInstanceOf(AuthenticationException.class) + .hasMessage("invalid hash stored"); + UserDto userInvalidIterations = newUserDto() .setHashMethod(PBKDF2.name()) - .setCryptedPassword("$$") + .setCryptedPassword("a$") .setSalt(salt); assertThatThrownBy(() -> underTest.authenticate(dbSession, userInvalidIterations, "WHATEVER", AuthenticationEvent.Method.BASIC)) -- cgit v1.2.3