diff options
author | Belen Pruvost <belen.pruvost@sonarsource.com> | 2021-06-07 09:29:21 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-06-07 20:31:13 +0000 |
commit | 9d4d5b0a9f8dd38403f48fad508f9fa438999834 (patch) | |
tree | 5d5dbebebb5075e87e20e795da180d261a0a5699 /server | |
parent | 20f4ec8ce1cfcc5b7b2cdbee84bbb9144459637e (diff) | |
download | sonarqube-9d4d5b0a9f8dd38403f48fad508f9fa438999834.tar.gz sonarqube-9d4d5b0a9f8dd38403f48fad508f9fa438999834.zip |
SONAR-14682 - Fix Check URL Pattern Unit Test
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/WebhookSupportTest.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/WebhookSupportTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/WebhookSupportTest.java index 2ebc93aa839..f61d4ef16da 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/WebhookSupportTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/WebhookSupportTest.java @@ -27,7 +27,6 @@ import java.io.IOException; import java.net.InetAddress; import java.net.SocketException; import okhttp3.HttpUrl; -import org.assertj.core.api.Assertions; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -35,10 +34,10 @@ import org.sonar.api.config.Configuration; import org.sonar.server.user.UserSession; import static java.util.Optional.of; -import static org.assertj.core.api.Assertions.*; import static org.assertj.core.api.Assertions.assertThatCode; 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; @RunWith(DataProviderRunner.class) @@ -112,8 +111,10 @@ public class WebhookSupportTest { public void itThrowsIllegalExceptionIfGettingNetworkInterfaceAddressesFails() throws SocketException { when(networkInterfaceProvider.getNetworkInterfaceAddresses()).thenThrow(new SocketException()); - assertThatThrownBy(() -> underTest.checkUrlPattern("good-url.com", "msg")) - .hasMessageContaining("") - .isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> underTest.checkUrlPattern("https://good-url.com", "msg")) + .hasMessageContaining("Can not retrieve a network interfaces") + .isInstanceOf(IllegalStateException.class); + + verify(networkInterfaceProvider).getNetworkInterfaceAddresses(); } } |