openvidu-server: update unit and integration tests to new JUnit version

pull/772/head
pabloFuente 2022-11-27 17:26:20 +01:00
parent 13f404d072
commit fe2f668d58
5 changed files with 170 additions and 245 deletions

View File

@ -20,7 +20,7 @@ package io.openvidu.server.test.integration;
import java.util.HashMap;
import java.util.UUID;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
@ -75,18 +75,18 @@ public class SessionGarbageCollectorIntegrationTest {
getSession();
jsonResponse = listSessions();
Assert.assertEquals("Wrong number of sessions", 1, jsonResponse.get("numberOfElements").getAsInt());
Assertions.assertEquals(1, jsonResponse.get("numberOfElements").getAsInt(), "Wrong number of sessions");
Thread.sleep(2000);
jsonResponse = listSessions();
Assert.assertEquals("Wrong number of sessions", 0, jsonResponse.get("numberOfElements").getAsInt());
Assertions.assertEquals(0, jsonResponse.get("numberOfElements").getAsInt(), "Wrong number of sessions");
getSession();
getSession();
Session session = getSession();
jsonResponse = listSessions();
Assert.assertEquals("Wrong number of sessions", 3, jsonResponse.get("numberOfElements").getAsInt());
Assertions.assertEquals(3, jsonResponse.get("numberOfElements").getAsInt(), "Wrong number of sessions");
String token = getToken(session);
joinParticipant(session, token);
@ -94,7 +94,7 @@ public class SessionGarbageCollectorIntegrationTest {
Thread.sleep(2000);
jsonResponse = listSessions();
Assert.assertEquals("Wrong number of sessions", 1, jsonResponse.get("numberOfElements").getAsInt());
Assertions.assertEquals(1, jsonResponse.get("numberOfElements").getAsInt(), "Wrong number of sessions");
}
private Session getSession() {

View File

@ -23,7 +23,7 @@ import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
@ -93,7 +93,7 @@ public class WebhookIntegrationTest {
try {
this.webhook = Whitebox.getInternalState(cdrLoggerWebhook, "webhookSender");
} catch (Exception e) {
Assert.fail("Error getting private property from stubbed object: " + e.getMessage());
Assertions.fail("Error getting private property from stubbed object: " + e.getMessage());
}
CloseableHttpResponse httpResponse = mock(CloseableHttpResponse.class);
@ -109,7 +109,7 @@ public class WebhookIntegrationTest {
try {
httpClient = Whitebox.getInternalState(webhook, "httpClient");
} catch (Exception e) {
Assert.fail("Error getting private property from stubbed object: " + e.getMessage());
Assertions.fail("Error getting private property from stubbed object: " + e.getMessage());
}
httpClient = PowerMockito.spy(httpClient);
doAnswer(invocationOnMock -> {
@ -133,7 +133,7 @@ public class WebhookIntegrationTest {
try {
if (!initLatch.await(30, TimeUnit.SECONDS)) {
Assert.fail("Timeout waiting for webhook springboot app to start");
Assertions.fail("Timeout waiting for webhook springboot app to start");
CustomWebhook.shutDown();
return;
}
@ -206,11 +206,11 @@ public class WebhookIntegrationTest {
JsonObject signal5 = CustomWebhook.waitForEvent("signalSent", 25, TimeUnit.MILLISECONDS);
// Order of webhook events should be honored
Assert.assertEquals("Wrong signal type", "1", signal1.get("type").getAsString());
Assert.assertEquals("Wrong signal type", "2", signal2.get("type").getAsString());
Assert.assertEquals("Wrong signal type", "3", signal3.get("type").getAsString());
Assert.assertEquals("Wrong signal type", "4", signal4.get("type").getAsString());
Assert.assertEquals("Wrong signal type", "5", signal5.get("type").getAsString());
Assertions.assertEquals("1", signal1.get("type").getAsString(), "Wrong signal type");
Assertions.assertEquals("2", signal2.get("type").getAsString(), "Wrong signal type");
Assertions.assertEquals("3", signal3.get("type").getAsString(), "Wrong signal type");
Assertions.assertEquals("4", signal4.get("type").getAsString(), "Wrong signal type");
Assertions.assertEquals("5", signal5.get("type").getAsString(), "Wrong signal type");
this.sessionRestController.closeConnection(sessionId, participant.getParticipantPublicId());

View File

@ -9,7 +9,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;
import org.kurento.client.Continuation;
import org.kurento.client.KurentoClient;
import org.kurento.client.MediaPipeline;
@ -46,7 +46,7 @@ public class IntegrationTestConfiguration {
try {
kmsProperties = invocation.getArgument(0);
} catch (Exception e) {
Assert.fail("Error getting argument from stubbed method: " + e.getMessage());
Assertions.fail("Error getting argument from stubbed method: " + e.getMessage());
}
for (KmsProperties kmsProp : kmsProperties) {
@ -54,7 +54,7 @@ public class IntegrationTestConfiguration {
try {
loadManager = Whitebox.getInternalState(spy, "loadManager");
} catch (Exception e) {
Assert.fail("Error getting private property from stubbed object: " + e.getMessage());
Assertions.fail("Error getting private property from stubbed object: " + e.getMessage());
}
Kms kms = new Kms(kmsProp, loadManager, spy);
KurentoClient kClient = mock(KurentoClient.class);

View File

@ -1,249 +1,174 @@
package io.openvidu.server.test.unit;
import io.openvidu.java.client.IceServerProperties;
import org.junit.Test;
import org.junit.jupiter.api.DisplayName;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import io.openvidu.java.client.IceServerProperties;
public class IceServerPropertiesTest {
@Test
@DisplayName("IceServerProperty exceptions tests")
public void iceServerPropertiesExceptionTest() {
// Wrong urls
notValidIceServerTest(
"wrongurl", null, null,
"Not a valid TURN/STUN uri provided. No colons found in: 'wrongurl'"
);
notValidIceServerTest(
"wrongurl", "anyuser", null,
"Not a valid TURN/STUN uri provided. No colons found in: 'wrongurl'"
);
notValidIceServerTest(
"wrongurl", null, "anypassword",
"Not a valid TURN/STUN uri provided. No colons found in: 'wrongurl'"
);
notValidIceServerTest(
"wrongurl", "anyuser", "anypassword",
"Not a valid TURN/STUN uri provided. No colons found in: 'wrongurl'"
);
@Test
@DisplayName("IceServerProperty exceptions tests")
public void iceServerPropertiesExceptionTest() {
// Wrong urls
notValidIceServerTest("wrongurl", null, null,
"Not a valid TURN/STUN uri provided. No colons found in: 'wrongurl'");
notValidIceServerTest("wrongurl", "anyuser", null,
"Not a valid TURN/STUN uri provided. No colons found in: 'wrongurl'");
notValidIceServerTest("wrongurl", null, "anypassword",
"Not a valid TURN/STUN uri provided. No colons found in: 'wrongurl'");
notValidIceServerTest("wrongurl", "anyuser", "anypassword",
"Not a valid TURN/STUN uri provided. No colons found in: 'wrongurl'");
// Wrong prefixes
notValidIceServerTest(
"turnss:wrongurl", null, null,
"The protocol 'turnss' is invalid. Only valid values are: [turn, turns] [stuns, stun]"
);
notValidIceServerTest(
"stunss:wrongurl", "anyuser", null,
"The protocol 'stunss' is invalid. Only valid values are: [turn, turns] [stuns, stun]"
);
notValidIceServerTest(
"anything:wrongurl", null, "anypassword",
"The protocol 'anything' is invalid. Only valid values are: [turn, turns] [stuns, stun]"
);
notValidIceServerTest(
":", null, null,
"The protocol '' is invalid. Only valid values are: [turn, turns] [stuns, stun]"
);
notValidIceServerTest(
"", null, null,
"Not a valid TURN/STUN uri provided. No colons found in: ''"
);
// Wrong prefixes
notValidIceServerTest("turnss:wrongurl", null, null,
"The protocol 'turnss' is invalid. Only valid values are: [turn, turns] [stuns, stun]");
notValidIceServerTest("stunss:wrongurl", "anyuser", null,
"The protocol 'stunss' is invalid. Only valid values are: [turn, turns] [stuns, stun]");
notValidIceServerTest("anything:wrongurl", null, "anypassword",
"The protocol 'anything' is invalid. Only valid values are: [turn, turns] [stuns, stun]");
notValidIceServerTest(":", null, null,
"The protocol '' is invalid. Only valid values are: [turn, turns] [stuns, stun]");
notValidIceServerTest("", null, null, "Not a valid TURN/STUN uri provided. No colons found in: ''");
// Try invalid host and ports
notValidIceServerTest(
"stun:hostname.com:99a99", null, null,
"The port defined in 'stun:hostname.com:99a99' is not a number (0-65535)"
);
notValidIceServerTest(
"stun:hostname.com:-1", null, null,
"The port defined in 'stun:hostname.com:-1' is not a valid port number (0-65535)"
);
notValidIceServerTest(
"stun:hostname:port:more", null, null,
"Host or port are not correctly defined in STUN/TURN uri: 'stun:hostname:port:more'"
);
notValidIceServerTest(
"stun:hostname.com:port more", null, null,
"The port defined in 'stun:hostname.com:port more' is not a number (0-65535)"
);
notValidIceServerTest(
"stun:hostname.com:", null, null,
"Host or port are not correctly defined in STUN/TURN uri: 'stun:hostname.com:'"
);
notValidIceServerTest(
"stun:[1:2:3:4:5:6:7:8]junk:1000", null, null,
"Port is not specified correctly after IPv6 in uri: 'stun:[1:2:3:4:5:6:7:8]junk:1000'"
);
notValidIceServerTest(
"stun:[notvalid:]:1000", null, null,
"Is not a valid Internet Address (IP or Domain Name): 'notvalid:'"
);
notValidIceServerTest(
"stun::5555", null, null,
"Host defined in 'stun::5555' is empty or null"
);
notValidIceServerTest(
"stun:", null, null,
"Host defined in 'stun:' is empty or null"
);
// Try invalid host and ports
notValidIceServerTest("stun:hostname.com:99a99", null, null,
"The port defined in 'stun:hostname.com:99a99' is not a number (0-65535)");
notValidIceServerTest("stun:hostname.com:-1", null, null,
"The port defined in 'stun:hostname.com:-1' is not a valid port number (0-65535)");
notValidIceServerTest("stun:hostname:port:more", null, null,
"Host or port are not correctly defined in STUN/TURN uri: 'stun:hostname:port:more'");
notValidIceServerTest("stun:hostname.com:port more", null, null,
"The port defined in 'stun:hostname.com:port more' is not a number (0-65535)");
notValidIceServerTest("stun:hostname.com:", null, null,
"Host or port are not correctly defined in STUN/TURN uri: 'stun:hostname.com:'");
notValidIceServerTest("stun:[1:2:3:4:5:6:7:8]junk:1000", null, null,
"Port is not specified correctly after IPv6 in uri: 'stun:[1:2:3:4:5:6:7:8]junk:1000'");
notValidIceServerTest("stun:[notvalid:]:1000", null, null,
"Is not a valid Internet Address (IP or Domain Name): 'notvalid:'");
notValidIceServerTest("stun::5555", null, null, "Host defined in 'stun::5555' is empty or null");
notValidIceServerTest("stun:", null, null, "Host defined in 'stun:' is empty or null");
// Illegal Uri tests according to RFC 3986 and RFC 7064 (URI schemes for STUN and TURN)
notValidIceServerTest(
"stun:/hostname.com", null, null,
"Is not a valid Internet Address (IP or Domain Name): '/hostname.com'"
);
notValidIceServerTest(
"stun:?hostname.com", null, null,
"STUN uri can't have any '?' query param"
);
notValidIceServerTest(
"stun:#hostname.com", null, null,
"Is not a valid Internet Address (IP or Domain Name): '#hostname.com'"
);
// Illegal Uri tests according to RFC 3986 and RFC 7064 (URI schemes for STUN
// and TURN)
notValidIceServerTest("stun:/hostname.com", null, null,
"Is not a valid Internet Address (IP or Domain Name): '/hostname.com'");
notValidIceServerTest("stun:?hostname.com", null, null, "STUN uri can't have any '?' query param");
notValidIceServerTest("stun:#hostname.com", null, null,
"Is not a valid Internet Address (IP or Domain Name): '#hostname.com'");
// illegal ?transport=xxx tests in turn uris
notValidIceServerTest(
"turn:hostname.com?transport=invalid", "anyuser", "anypassword",
"Wrong value specified in STUN/TURN uri: 'turn:hostname.com?transport=invalid'. Unique valid arguments after '?' are '?transport=tcp' or '?transport=udp"
);
notValidIceServerTest(
"turn:hostname.com?transport=", "anyuser", "anypassword",
"Wrong value specified in STUN/TURN uri: 'turn:hostname.com?transport='. Unique valid arguments after '?' are '?transport=tcp' or '?transport=udp"
);
notValidIceServerTest(
"turn:hostname.com?=", "anyuser", "anypassword",
"Wrong value specified in STUN/TURN uri: 'turn:hostname.com?='. Unique valid arguments after '?' are '?transport=tcp' or '?transport=udp"
);
notValidIceServerTest(
"turn:hostname.com?", "anyuser", "anypassword",
"Wrong value specified in STUN/TURN uri: 'turn:hostname.com?'. Unique valid arguments after '?' are '?transport=tcp' or '?transport=udp"
);
notValidIceServerTest(
"?", "anyuser", "anypassword",
"Not a valid TURN/STUN uri provided. No colons found in: '?'"
);
// illegal ?transport=xxx tests in turn uris
notValidIceServerTest("turn:hostname.com?transport=invalid", "anyuser", "anypassword",
"Wrong value specified in STUN/TURN uri: 'turn:hostname.com?transport=invalid'. Unique valid arguments after '?' are '?transport=tcp' or '?transport=udp");
notValidIceServerTest("turn:hostname.com?transport=", "anyuser", "anypassword",
"Wrong value specified in STUN/TURN uri: 'turn:hostname.com?transport='. Unique valid arguments after '?' are '?transport=tcp' or '?transport=udp");
notValidIceServerTest("turn:hostname.com?=", "anyuser", "anypassword",
"Wrong value specified in STUN/TURN uri: 'turn:hostname.com?='. Unique valid arguments after '?' are '?transport=tcp' or '?transport=udp");
notValidIceServerTest("turn:hostname.com?", "anyuser", "anypassword",
"Wrong value specified in STUN/TURN uri: 'turn:hostname.com?'. Unique valid arguments after '?' are '?transport=tcp' or '?transport=udp");
notValidIceServerTest("?", "anyuser", "anypassword",
"Not a valid TURN/STUN uri provided. No colons found in: '?'");
// Transport can not be defined in STUN
notValidIceServerTest(
"stun:hostname.com?transport=tcp", null, null,
"STUN uri can't have any '?' query param"
);
notValidIceServerTest(
"stun:hostname.com?transport=udp", null, null,
"STUN uri can't have any '?' query param"
);
// Transport can not be defined in STUN
notValidIceServerTest("stun:hostname.com?transport=tcp", null, null, "STUN uri can't have any '?' query param");
notValidIceServerTest("stun:hostname.com?transport=udp", null, null, "STUN uri can't have any '?' query param");
// Stun can not have credentials defined
notValidIceServerTest(
"stun:hostname.com", "username", "credential",
"Credentials can not be defined while using stun."
);
notValidIceServerTest(
"stun:hostname.com", "username", "credential",
"Credentials can not be defined while using stun."
);
notValidIceServerTest(
"stun:hostname.com", "username", null,
"Credentials can not be defined while using stun."
);
notValidIceServerTest(
"stun:hostname.com", null, "credential",
"Credentials can not be defined while using stun."
);
// Stun can not have credentials defined
notValidIceServerTest("stun:hostname.com", "username", "credential",
"Credentials can not be defined while using stun.");
notValidIceServerTest("stun:hostname.com", "username", "credential",
"Credentials can not be defined while using stun.");
notValidIceServerTest("stun:hostname.com", "username", null,
"Credentials can not be defined while using stun.");
notValidIceServerTest("stun:hostname.com", null, "credential",
"Credentials can not be defined while using stun.");
// Turn must have credentials
notValidIceServerTest(
"turn:hostname.com", null, null,
"Credentials must be defined while using turn"
);
notValidIceServerTest(
"turn:hostname.com", "username", null,
"Credentials must be defined while using turn"
);
notValidIceServerTest(
"turn:hostname.com", null, "credential",
"Credentials must be defined while using turn"
);
}
// Turn must have credentials
notValidIceServerTest("turn:hostname.com", null, null, "Credentials must be defined while using turn");
notValidIceServerTest("turn:hostname.com", "username", null, "Credentials must be defined while using turn");
notValidIceServerTest("turn:hostname.com", null, "credential", "Credentials must be defined while using turn");
}
@Test
@DisplayName("IceServerProperty exceptions tests")
public void iceServerPropertiesValidTest() {
// Stun and stuns
validIceServerTest("stun:hostname.com", null, null);
validIceServerTest("stuns:hostname.com", null, null);
@Test
@DisplayName("IceServerProperty exceptions tests")
public void iceServerPropertiesValidTest() {
// Stun and stuns
validIceServerTest("stun:hostname.com", null, null);
validIceServerTest("stuns:hostname.com", null, null);
// Turn and turns
validIceServerTest("turn:hostname.com", "anyuser", "credential");
validIceServerTest("turns:hostname.com", "anyuser", "credential");
// Turn and turns
validIceServerTest("turn:hostname.com", "anyuser", "credential");
validIceServerTest("turns:hostname.com", "anyuser", "credential");
// Test IPv4/IPv6/hostname and with/without port
validIceServerTest("stun:1.2.3.4:1234", null, null);
validIceServerTest("stun:[1:2:3:4:5:6:7:8]:4321", null, null);
validIceServerTest("stun:hostname.com:9999", null, null);
validIceServerTest("stun:1.2.3.4", null, null);
validIceServerTest("stun:[1:2:3:4:5:6:7:8]", null, null);
validIceServerTest("stuns:1.2.3.4:1234", null, null);
validIceServerTest("stuns:[1:2:3:4:5:6:7:8]:4321", null, null);
validIceServerTest("stuns:hostname.com:9999", null, null);
validIceServerTest("stuns:1.2.3.4", null, null);
validIceServerTest("stuns:[1:2:3:4:5:6:7:8]", null, null);
validIceServerTest("turn:1.2.3.4:1234", "anyuser", "credential");
validIceServerTest("turn:[1:2:3:4:5:6:7:8]:4321", "anyuser", "credential");
validIceServerTest("turn:hostname.com:9999", "anyuser", "credential");
validIceServerTest("turn:1.2.3.4", "anyuser", "credential");
validIceServerTest("turn:[1:2:3:4:5:6:7:8]", "anyuser", "credential");
validIceServerTest("turns:1.2.3.4:1234", "anyuser", "credential");
validIceServerTest("turns:[1:2:3:4:5:6:7:8]:4321", "anyuser", "credential");
validIceServerTest("turns:hostname.com:9999", "anyuser", "credential");
validIceServerTest("turns:1.2.3.4", "anyuser", "credential");
validIceServerTest("turns:[1:2:3:4:5:6:7:8]", "anyuser", "credential");
// Test IPv4/IPv6/hostname and with/without port
validIceServerTest("stun:1.2.3.4:1234", null, null);
validIceServerTest("stun:[1:2:3:4:5:6:7:8]:4321", null, null);
validIceServerTest("stun:hostname.com:9999", null, null);
validIceServerTest("stun:1.2.3.4", null, null);
validIceServerTest("stun:[1:2:3:4:5:6:7:8]", null, null);
validIceServerTest("stuns:1.2.3.4:1234", null, null);
validIceServerTest("stuns:[1:2:3:4:5:6:7:8]:4321", null, null);
validIceServerTest("stuns:hostname.com:9999", null, null);
validIceServerTest("stuns:1.2.3.4", null, null);
validIceServerTest("stuns:[1:2:3:4:5:6:7:8]", null, null);
validIceServerTest("turn:1.2.3.4:1234", "anyuser", "credential");
validIceServerTest("turn:[1:2:3:4:5:6:7:8]:4321", "anyuser", "credential");
validIceServerTest("turn:hostname.com:9999", "anyuser", "credential");
validIceServerTest("turn:1.2.3.4", "anyuser", "credential");
validIceServerTest("turn:[1:2:3:4:5:6:7:8]", "anyuser", "credential");
validIceServerTest("turns:1.2.3.4:1234", "anyuser", "credential");
validIceServerTest("turns:[1:2:3:4:5:6:7:8]:4321", "anyuser", "credential");
validIceServerTest("turns:hostname.com:9999", "anyuser", "credential");
validIceServerTest("turns:1.2.3.4", "anyuser", "credential");
validIceServerTest("turns:[1:2:3:4:5:6:7:8]", "anyuser", "credential");
// Test valid ?transport=tcp or ?transport=udp
validIceServerTest("turn:hostname.com:1234?transport=tcp", "anyuser", "credential");
validIceServerTest("turn:hostname.com?transport=udp", "anyuser", "credential");
validIceServerTest("turn:1.2.3.4:1234?transport=tcp", "anyuser", "credential");
validIceServerTest("turn:1.2.3.4?transport=udp", "anyuser", "credential");
validIceServerTest("turn:[1:2:3:4:5:6:7:8]:4321?transport=udp", "anyuser", "credential");
validIceServerTest("turn:[1:2:3:4:5:6:7:8]?transport=udp", "anyuser", "credential");
}
// Test valid ?transport=tcp or ?transport=udp
validIceServerTest("turn:hostname.com:1234?transport=tcp", "anyuser", "credential");
validIceServerTest("turn:hostname.com?transport=udp", "anyuser", "credential");
validIceServerTest("turn:1.2.3.4:1234?transport=tcp", "anyuser", "credential");
validIceServerTest("turn:1.2.3.4?transport=udp", "anyuser", "credential");
validIceServerTest("turn:[1:2:3:4:5:6:7:8]:4321?transport=udp", "anyuser", "credential");
validIceServerTest("turn:[1:2:3:4:5:6:7:8]?transport=udp", "anyuser", "credential");
}
private void validIceServerTest(String url, String username, String credential) {
assertDoesNotThrow(() -> {
IceServerProperties.Builder iceServerPropertiesBuilder = new IceServerProperties.Builder().url(url);
if (username != null) {
iceServerPropertiesBuilder.username(username);
}
if (credential != null) {
iceServerPropertiesBuilder.credential(credential);
}
IceServerProperties iceServerProperties = iceServerPropertiesBuilder.build();
assertEquals(url, iceServerProperties.getUrl());
if (username != null) {
assertEquals(username, iceServerProperties.getUsername());
}
if (credential != null) {
assertEquals(credential, iceServerProperties.getCredential());
}
});
}
private void validIceServerTest(String url, String username, String credential) {
assertDoesNotThrow(() -> {
IceServerProperties.Builder iceServerPropertiesBuilder = new IceServerProperties.Builder().url(url);
if (username != null) {
iceServerPropertiesBuilder.username(username);
}
if (credential != null) {
iceServerPropertiesBuilder.credential(credential);
}
IceServerProperties iceServerProperties = iceServerPropertiesBuilder.build();
assertEquals(url, iceServerProperties.getUrl());
if (username != null) {
assertEquals(username, iceServerProperties.getUsername());
}
if (credential != null) {
assertEquals(credential, iceServerProperties.getCredential());
}
});
}
private void notValidIceServerTest(String url, String username, String credential, String expectedMessage) {
Exception exception = assertThrows(IllegalArgumentException.class, () -> {
IceServerProperties.Builder iceServerPropertiesBuilder = new IceServerProperties.Builder().url(url);
if (username != null) {
iceServerPropertiesBuilder.username(username);
}
if (credential != null) {
iceServerPropertiesBuilder.credential(credential);
}
iceServerPropertiesBuilder.build();
});
private void notValidIceServerTest(String url, String username, String credential, String expectedMessage) {
Exception exception = assertThrows(IllegalArgumentException.class, () -> {
IceServerProperties.Builder iceServerPropertiesBuilder = new IceServerProperties.Builder().url(url);
if (username != null) {
iceServerPropertiesBuilder.username(username);
}
if (credential != null) {
iceServerPropertiesBuilder.credential(credential);
}
iceServerPropertiesBuilder.build();
});
String actualMessage = exception.getMessage();
assertEquals(actualMessage, expectedMessage);
}
String actualMessage = exception.getMessage();
assertEquals(actualMessage, expectedMessage);
}
}

View File

@ -11,8 +11,8 @@ import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import io.openvidu.client.OpenViduException;
import io.openvidu.java.client.VideoCodec;