-
Notifications
You must be signed in to change notification settings - Fork 6
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
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...ssing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/dictionary/Concept.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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
package edu.harvard.hms.dbmi.avillach.hpds.processing.dictionary; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
|
||
import java.util.Map; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record Concept(String type, String conceptPath, String name, String display, String dataset, String description, Map<String, String> meta) { | ||
} |
25 changes: 25 additions & 0 deletions
25
...g/src/test/java/edu/harvard/hms/dbmi/avillach/hpds/processing/dictionary/ConceptTest.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,25 @@ | ||
package edu.harvard.hms.dbmi.avillach.hpds.processing.dictionary; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class ConceptTest { | ||
|
||
@Test | ||
public void jsonSerialization() throws JsonProcessingException { | ||
Concept[] concepts = new Concept[]{new Concept("Categorical", "\\demographics\\age\\", "age", "AGE", null, "patient age", Map.of("drs_uri", "[\"a-drs.uri\", \"another-drs.uri\"]"))}; | ||
ObjectMapper objectMapper = new ObjectMapper(); | ||
|
||
String serialized = objectMapper.writeValueAsString(concepts); | ||
|
||
Concept[] deserialized = objectMapper.readValue(serialized, Concept[].class); | ||
|
||
assertEquals(List.of(concepts), List.of(deserialized)); | ||
} | ||
} |