Skip to content

Commit

Permalink
Merge pull request #471 from edmcouncil/unit_test_extension_for_gsrs
Browse files Browse the repository at this point in the history
Unit test extension for gsrs
  • Loading branch information
ElisaKendall authored Sep 22, 2023
2 parents 7fdf67a + 68a5c72 commit be9729b
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
6 changes: 5 additions & 1 deletion etc/unit_tests/UnitTestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,14 @@ private static boolean isResultExpected(String actual, String expected) {
JsonNode expectedJson = objectMapper.readTree(expected);

JsonNode diff = JsonDiff.asJson(actualJson, expectedJson);

if (diff.size() > 0) {
System.out.println("Differences found:");
System.out.println(diff);
System.out.println("Actual results:");
System.out.println(actualJson);
System.out.println("Expected results:");
System.out.println(expectedJson);
return false;
}
} catch (IOException e) {
Expand Down
13 changes: 13 additions & 0 deletions etc/unit_tests/configs/gsrs_tests_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,16 @@ uc1_cq1_tests:
parameters:
uc1_cq1_parameter_1: "<https://gsrs.ncats.nih.gov/api/v1/substances/1J444QC288>"
expected_output: "cq_expected_results/GSRS/uc1_cq1_expected_results.json"

uc1_cq2_tests:
sparql_template: "cq_templates/uc1_cq2.sparql"
parameters:
uc1_cq2_parameter_1: "<https://gsrs.ncats.nih.gov/api/v1/substances/V912825CB9>"
expected_output: "cq_expected_results/GSRS/uc1_cq2_expected_results.json"

uc1_cq4_tests:
sparql_template: "cq_templates/uc1_cq4.sparql"
parameters:
uc1_cq4_parameter_1: "<https://gsrs.ncats.nih.gov/api/v1/substances/1J444QC288>"
uc1_cq4_parameter_2: "<https://spec.pistoiaalliance.org/idmp/ontology/ISO/ISO11238-RegistrationAuthorities/GlobalSubstanceRegistrationSystem>"
expected_output: "cq_expected_results/GSRS/uc1_cq4_expected_results.json"
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"results": {
"bindings": [
{
"ActiveMoiety": {
"type": "uri",
"value": "https://gsrs.ncats.nih.gov/api/v1/substances/1J444QC288"
},
"ActiveMoietyName": {
"type": "literal",
"value": "AMLODIPINE"
}
}
]
},
"head": {
"vars": [
"ActiveMoiety",
"ActiveMoietyName"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ "head": {
"vars": [ "Code" , "CodeName" , "CodeText" ]
} ,
"results": {
"bindings": [
{
"Code": { "type": "uri" , "value": "https://spec.pistoiaalliance.org/idmp/ontology/EXT/Examples/AmlodipineExample/UNII-1J444QC288" } ,
"CodeName": { "type": "literal" , "value": "1J444QC288" } ,
"CodeText": { "type": "literal" , "value": "1J444QC288" }
},
{
"Code": { "type": "uri" , "value": "https://data.pistoiaalliance.org/id/FDA_UNII/1J444QC288" } ,
"CodeText": { "type": "literal" , "value": "1J444QC288" }
}
]
}
}

0 comments on commit be9729b

Please sign in to comment.