|
14 | 14 | import static org.eclipse.rdf4j.rio.helpers.JSONLDSettings.SECURE_MODE; |
15 | 15 | import static org.eclipse.rdf4j.rio.helpers.JSONLDSettings.WHITELIST; |
16 | 16 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 17 | +import static org.junit.jupiter.api.Assertions.assertFalse; |
17 | 18 | import static org.junit.jupiter.api.Assertions.assertTrue; |
18 | 19 |
|
19 | 20 | import java.io.File; |
20 | 21 | import java.io.StringReader; |
21 | 22 | import java.net.URI; |
22 | 23 | import java.nio.charset.StandardCharsets; |
| 24 | +import java.util.List; |
| 25 | +import java.util.ServiceLoader; |
23 | 26 | import java.util.Set; |
| 27 | +import java.util.stream.Collectors; |
24 | 28 |
|
25 | 29 | import org.apache.commons.io.FileUtils; |
26 | 30 | import org.eclipse.rdf4j.model.IRI; |
|
44 | 48 | import org.junit.jupiter.api.RepeatedTest; |
45 | 49 | import org.junit.jupiter.api.Test; |
46 | 50 |
|
| 51 | +import jakarta.json.spi.JsonProvider; |
47 | 52 | import no.hasmac.jsonld.document.Document; |
48 | 53 | import no.hasmac.jsonld.document.JsonDocument; |
49 | 54 |
|
@@ -354,4 +359,15 @@ public void testRemoteContextException() throws Exception { |
354 | 359 | assertEquals("Could not load document from https://example.org/context.jsonld", rdfParseException.getMessage()); |
355 | 360 | } |
356 | 361 |
|
| 362 | + @Test |
| 363 | + public void testSPI() { |
| 364 | + ServiceLoader<JsonProvider> load = ServiceLoader.load(JsonProvider.class); |
| 365 | + List<String> collect = load.stream() |
| 366 | + .map(ServiceLoader.Provider::get) |
| 367 | + .map(t -> t.getClass().getName()) |
| 368 | + .collect(Collectors.toList()); |
| 369 | + assertFalse(collect.isEmpty()); |
| 370 | + assertEquals("org.glassfish.json.JsonProviderImpl", collect.stream().findFirst().orElse("")); |
| 371 | + } |
| 372 | + |
357 | 373 | } |
0 commit comments