1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.core.provisioning.api.utils;
20
21 import static org.junit.jupiter.api.Assertions.assertEquals;
22 import static org.junit.jupiter.api.Assertions.assertThrows;
23
24 import java.net.MalformedURLException;
25 import java.net.URI;
26 import java.net.URISyntaxException;
27 import java.util.concurrent.atomic.AtomicReference;
28 import org.apache.syncope.core.provisioning.api.AbstractTest;
29 import org.junit.jupiter.api.Test;
30
31 public class URIUtilsTest extends AbstractTest {
32
33 @Test
34 public void buildForConnId() throws URISyntaxException, MalformedURLException {
35 AtomicReference<String> location = new AtomicReference<>();
36 location.set("www.tirasa.net");
37 IllegalArgumentException exception =
38 assertThrows(IllegalArgumentException.class, () -> URIUtils.buildForConnId(location.get()));
39 assertEquals(exception.getClass(), IllegalArgumentException.class);
40
41 location.set("connid:test/location");
42 URI expectedURI = new URI(location.get().trim());
43 assertEquals(expectedURI, URIUtils.buildForConnId(location.get()));
44 }
45 }