diff options
author | Klaudio Sinani <klaudio.sinani@sonarsource.com> | 2021-11-17 22:54:06 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-11-19 20:03:27 +0000 |
commit | a3d88ea27c35921647d7602755828ca73e15e865 (patch) | |
tree | 5626c38afab1ea00ab9897da431476c17b478bbe /server/sonar-auth-bitbucket | |
parent | 92f482f2aa43e4aa36e0fda377d13b9dc3282ff9 (diff) | |
download | sonarqube-a3d88ea27c35921647d7602755828ca73e15e865.tar.gz sonarqube-a3d88ea27c35921647d7602755828ca73e15e865.zip |
SONAR-15631 - Refactor UTs to stop using ExpectedException
Diffstat (limited to 'server/sonar-auth-bitbucket')
-rwxr-xr-x | server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/BitbucketIdentityProviderTest.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/BitbucketIdentityProviderTest.java b/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/BitbucketIdentityProviderTest.java index d135fb14285..89bd3fb0f79 100755 --- a/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/BitbucketIdentityProviderTest.java +++ b/server/sonar-auth-bitbucket/src/test/java/org/sonar/auth/bitbucket/BitbucketIdentityProviderTest.java @@ -19,21 +19,18 @@ */ package org.sonar.auth.bitbucket; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.sonar.api.config.internal.MapSettings; import org.sonar.api.server.authentication.OAuth2IdentityProvider; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class BitbucketIdentityProviderTest { - @Rule - public ExpectedException thrown = ExpectedException.none(); private final MapSettings settings = new MapSettings(); private final BitbucketSettings bitbucketSettings = new BitbucketSettings(settings.asConfig()); @@ -75,9 +72,9 @@ public class BitbucketIdentityProviderTest { enableBitbucketAuthentication(false); OAuth2IdentityProvider.InitContext context = mock(OAuth2IdentityProvider.InitContext.class); - thrown.expect(IllegalStateException.class); - thrown.expectMessage("Bitbucket authentication is disabled"); - underTest.init(context); + assertThatThrownBy(() -> underTest.init(context)) + .isInstanceOf(IllegalStateException.class) + .hasMessage("Bitbucket authentication is disabled"); } private void enableBitbucketAuthentication(boolean enabled) { |