Kaynağa Gözat

[NO-JIRA] Fix unittest that relies on no longer existing domain

(cherry picked from commit 06a6bcc0e6)
branch-8.9
Zipeng WU 1 yıl önce
ebeveyn
işleme
163cfd9d12

+ 1
- 3
server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/WebhookSupportTest.java Dosyayı Görüntüle

import java.net.InetAddress; import java.net.InetAddress;
import java.net.SocketException; import java.net.SocketException;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import org.assertj.core.api.Assertions;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.sonar.server.user.UserSession; import org.sonar.server.user.UserSession;


import static java.util.Optional.of; 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.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
public void itThrowsIllegalExceptionIfGettingNetworkInterfaceAddressesFails() throws SocketException { public void itThrowsIllegalExceptionIfGettingNetworkInterfaceAddressesFails() throws SocketException {
when(networkInterfaceProvider.getNetworkInterfaceAddresses()).thenThrow(new SocketException()); when(networkInterfaceProvider.getNetworkInterfaceAddresses()).thenThrow(new SocketException());


assertThatThrownBy(() -> underTest.checkUrlPattern("good-url.com", "msg"))
assertThatThrownBy(() -> underTest.checkUrlPattern("sonarsource.com", "msg"))
.hasMessageContaining("") .hasMessageContaining("")
.isInstanceOf(IllegalArgumentException.class); .isInstanceOf(IllegalArgumentException.class);
} }

Loading…
İptal
Kaydet