-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
76 additions
and
41 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/main/java/com/apicatalog/linkedtree/jakarta/JakartaLinkedTree.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.apicatalog.linkedtree.jakarta; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
import com.apicatalog.linkedtree.LinkedTree; | ||
|
||
import jakarta.json.JsonArray; | ||
|
||
public class JakartaLinkedTree { | ||
|
||
|
||
public static Collection<LinkedTree> read(JsonArray expanded) { | ||
|
||
return Collections.EMPTY_LIST; | ||
} | ||
|
||
public static JsonArray write(Collection<LinkedTree> tree) { | ||
|
||
return JsonArray.EMPTY_JSON_ARRAY; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
src/test/java/com/apicatalog/linkedtree/jakarta/JakartaTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.apicatalog.linkedtree.jakarta; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
import java.util.stream.Stream; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; | ||
import org.junit.jupiter.api.TestMethodOrder; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
import com.apicatalog.linkedtree.LinkedTree; | ||
|
||
import jakarta.json.Json; | ||
import jakarta.json.JsonArray; | ||
|
||
@DisplayName("Jakarta Test Suite") | ||
@TestMethodOrder(OrderAnnotation.class) | ||
class JakartaTest { | ||
|
||
@DisplayName("Read/Write") | ||
@ParameterizedTest(name = "{0}") | ||
@MethodSource({ "expandedResources" }) | ||
void readWrite(String name, JsonArray input) { | ||
|
||
var tree = JakartaLinkedTree.read(input); | ||
|
||
assertNotNull(tree); | ||
|
||
var output = JakartaLinkedTree.write(tree); | ||
|
||
assertNotNull(output); | ||
|
||
assertEquals(input, output); | ||
} | ||
|
||
static final Stream<Object[]> expandedResources() throws IOException, URISyntaxException { | ||
return Files.walk(Paths.get(LinkedTree.class.getResource("").toURI()), 1) | ||
.filter(name -> name.toString().endsWith("out.jsonld")) | ||
.sorted() | ||
.map(path -> { | ||
try (var reader = Json.createReader(LinkedTree.class.getResourceAsStream(path.getFileName().toString()))) { | ||
return new Object[] { path.getFileName().toString(), reader.readArray() }; | ||
} | ||
}); | ||
} | ||
} |