Skip to content

Commit c98da43

Browse files
author
John J. Aylward
committed
Refs stleary#537 Add test cases to verify no issue
1 parent 734f182 commit c98da43

3 files changed

Lines changed: 433 additions & 0 deletions

File tree

src/test/java/org/json/junit/XMLTest.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ of this software and associated documentation files (the "Software"), to deal
3434
import java.io.FileReader;
3535
import java.io.FileWriter;
3636
import java.io.IOException;
37+
import java.io.InputStream;
38+
import java.io.InputStreamReader;
3739
import java.io.Reader;
3840
import java.io.StringReader;
3941

4042
import org.json.JSONArray;
4143
import org.json.JSONException;
4244
import org.json.JSONObject;
45+
import org.json.JSONTokener;
4346
import org.json.XML;
4447
import org.json.XMLParserConfiguration;
4548
import org.junit.Rule;
@@ -898,4 +901,42 @@ public void testToJsonWithNullWhenNilConversionDisabled() {
898901
final JSONObject json = XML.toJSONObject(originalXml, new XMLParserConfiguration());
899902
assertEquals(expectedJsonString, json.toString());
900903
}
904+
905+
/**
906+
* Tests to verify that supported escapes in XML are converted to actual values.
907+
*/
908+
@Test
909+
public void testIssue537CaseSensitiveHexEscapeMinimal(){
910+
String xmlStr =
911+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
912+
"<root>Neutrophils.Hypersegmented &#X7C; Bld-Ser-Plas</root>";
913+
String expectedStr =
914+
"{\"root\":\"Neutrophils.Hypersegmented | Bld-Ser-Plas\"}";
915+
JSONObject xmlJSONObj = XML.toJSONObject(xmlStr, true);
916+
JSONObject expected = new JSONObject(expectedStr);
917+
Util.compareActualVsExpectedJsonObjects(xmlJSONObj, expected);
918+
}
919+
920+
/**
921+
* Tests to verify that supported escapes in XML are converted to actual values.
922+
*/
923+
@Test
924+
public void testIssue537CaseSensitiveHexEscapeFullFile(){
925+
try {
926+
try(
927+
InputStream xmlStream = XMLTest.class.getClassLoader().getResourceAsStream("Issue537.xml");
928+
Reader xmlReader = new InputStreamReader(xmlStream);
929+
){
930+
JSONObject actual = XML.toJSONObject(xmlReader, true);
931+
try(
932+
InputStream jsonStream = XMLTest.class.getClassLoader().getResourceAsStream("Issue537.json");
933+
){
934+
final JSONObject expected = new JSONObject(new JSONTokener(jsonStream));
935+
Util.compareActualVsExpectedJsonObjects(actual,expected);
936+
}
937+
}
938+
} catch (IOException e) {
939+
fail("file writer error: " +e.getMessage());
940+
}
941+
}
901942
}

src/test/resources/Issue537.json

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
{
2+
"clinical_study": {
3+
"brief_summary": {
4+
"textblock": "CLEAR SYNERGY is an international multi center 2x2 randomized placebo controlled trial of\r\n colchicine and spironolactone in patients with STEMI. Subjects enrolled in the main CLEAR\r\n SYNERGY trial will be asked to participate in this sub study (n=670) to undergo:\r\n\r\n 1. Evaluation of markers of neutrophil activity at randomization (baseline) and 3 months\r\n follow-up in the colchicine versus placebo groups, and;\r\n\r\n 2. Examination of clinical and genetic factors that determine heterogeneity of treatment\r\n response and distinguish colchicine responders from non- responders.\r\n\r\n Participants undergo a blood draw at baseline and 3 months follow-up as part of the main\r\n trial, and participants who also participate in this sub study will have an additional 2\r\n tablespoons of blood drawn.\r\n\r\n The sub study objectives are to:\r\n\r\n 1. Assess the effect of colchicine on neutrophil activation in response to STEMI.\r\n\r\n 2. Examine clinical and genetic factors that determine heterogeneity of treatment response\r\n anddistinguish colchicine responders from non- responders.\r\n\r\n 3. Explore the derivation of a risk score that includes markers of neutrophil activity and\r\n is associated with adjudicated MACE over 3 years after STEMI, and assess the impact of\r\n colchicine on the relation between this risk score and MACE."
5+
},
6+
"brief_title": "CLEAR SYNERGY Neutrophil Substudy",
7+
"overall_status": "Recruiting",
8+
"eligibility": {
9+
"study_pop": {
10+
"textblock": "Patients who are randomized to the drug RCT portion of the CLEAR SYNERGY (OASIS 9) trial\r\n will be eligible for participation in this Neutrophil biomarker substudy. These are\r\n patients who present with STEMI."
11+
},
12+
"minimum_age": "19 Years",
13+
"sampling_method": "Non-Probability Sample",
14+
"gender": "All",
15+
"criteria": {
16+
"textblock": "Inclusion Criteria:\r\n\r\n - Patients who are randomized to the drug RCT portion of the CLEAR SYNERGY (OASIS 9)\r\n trial will be eligible for participation in this Neutrophil biomarker substudy.\r\n\r\n Exclusion Criteria:\r\n\r\n - Use of anti-inflammatory agents (except aspirin)\r\n\r\n - Active infection"
17+
},
18+
"healthy_volunteers": "No",
19+
"maximum_age": "110 Years"
20+
},
21+
"number_of_groups": "2",
22+
"source": "NYU Langone Health",
23+
"location_countries": {
24+
"country": "United States"
25+
},
26+
"study_design_info": {
27+
"time_perspective": "Prospective",
28+
"observational_model": "Other"
29+
},
30+
"last_update_submitted_qc": "September 10, 2019",
31+
"intervention_browse": {
32+
"mesh_term": "Colchicine"
33+
},
34+
"official_title": "Studies on the Effects of Colchicine on Neutrophil Biology in Acute Myocardial Infarction: A Substudy of the CLEAR SYNERGY (OASIS 9) Trial",
35+
"primary_completion_date": {
36+
"type": "Anticipated",
37+
"content": "February 1, 2021"
38+
},
39+
"sponsors": {
40+
"lead_sponsor": {
41+
"agency_class": "Other",
42+
"agency": "NYU Langone Health"
43+
},
44+
"collaborator": [
45+
{
46+
"agency_class": "Other",
47+
"agency": "Population Health Research Institute"
48+
},
49+
{
50+
"agency_class": "NIH",
51+
"agency": "National Heart, Lung, and Blood Institute (NHLBI)"
52+
}
53+
]
54+
},
55+
"overall_official": {
56+
"role": "Principal Investigator",
57+
"affiliation": "NYU School of Medicine",
58+
"last_name": "Binita Shah, MD"
59+
},
60+
"overall_contact_backup": {
61+
"last_name": "Binita Shah, MD"
62+
},
63+
"condition_browse": {
64+
"mesh_term": [
65+
"Myocardial Infarction",
66+
"ST Elevation Myocardial Infarction",
67+
"Infarction"
68+
]
69+
},
70+
"overall_contact": {
71+
"phone": "646-501-9648",
72+
"last_name": "Fatmira Curovic",
73+
"email": "fatmira.curovic@nyumc.org"
74+
},
75+
"responsible_party": {
76+
"responsible_party_type": "Principal Investigator",
77+
"investigator_title": "Assistant Professor of Medicine",
78+
"investigator_full_name": "Binita Shah",
79+
"investigator_affiliation": "NYU Langone Health"
80+
},
81+
"study_first_submitted_qc": "March 12, 2019",
82+
"start_date": {
83+
"type": "Actual",
84+
"content": "March 4, 2019"
85+
},
86+
"has_expanded_access": "No",
87+
"study_first_posted": {
88+
"type": "Actual",
89+
"content": "March 14, 2019"
90+
},
91+
"arm_group": [
92+
{
93+
"arm_group_label": "Colchicine"
94+
},
95+
{
96+
"arm_group_label": "Placebo"
97+
}
98+
],
99+
"primary_outcome": {
100+
"measure": "soluble L-selectin",
101+
"time_frame": "between baseline and 3 months",
102+
"description": "Change in soluble L-selectin between baseline and 3 mo after STEMI in the placebo vs. colchicine groups."
103+
},
104+
"secondary_outcome": [
105+
{
106+
"measure": "Other soluble markers of neutrophil activity",
107+
"time_frame": "between baseline and 3 months",
108+
"description": "Other markers of neutrophil activity will be evaluated at baseline and 3 months after STEMI (myeloperoxidase, matrix metalloproteinase-9, neutrophil gelatinase-associated lipocalin, neutrophil elastase, intercellular/vascular cellular adhesion molecules)"
109+
},
110+
{
111+
"measure": "Markers of systemic inflammation",
112+
"time_frame": "between baseline and 3 months",
113+
"description": "Markers of systemic inflammation will be evaluated at baseline and 3 months after STEMI (high sensitive CRP, IL-1β)"
114+
},
115+
{
116+
"measure": "Neutrophil-driven responses that may further propagate injury",
117+
"time_frame": "between baseline and 3 months",
118+
"description": "Neutrophil-driven responses that may further propagate injury will be evaluated at baseline and 3 months after STEMI (neutrophil extracellular traps, neutrophil-derived microparticles)"
119+
}
120+
],
121+
"oversight_info": {
122+
"is_fda_regulated_drug": "No",
123+
"is_fda_regulated_device": "No",
124+
"has_dmc": "No"
125+
},
126+
"last_update_posted": {
127+
"type": "Actual",
128+
"content": "September 12, 2019"
129+
},
130+
"id_info": {
131+
"nct_id": "NCT03874338",
132+
"org_study_id": "18-01323",
133+
"secondary_id": "1R01HL146206"
134+
},
135+
"enrollment": {
136+
"type": "Anticipated",
137+
"content": "670"
138+
},
139+
"study_first_submitted": "March 12, 2019",
140+
"condition": [
141+
"Neutrophils.Hypersegmented | Bld-Ser-Plas",
142+
"STEMI - ST Elevation Myocardial Infarction"
143+
],
144+
"study_type": "Observational",
145+
"required_header": {
146+
"download_date": "ClinicalTrials.gov processed this data on July 19, 2020",
147+
"link_text": "Link to the current ClinicalTrials.gov record.",
148+
"url": "https://clinicaltrials.gov/show/NCT03874338"
149+
},
150+
"last_update_submitted": "September 10, 2019",
151+
"completion_date": {
152+
"type": "Anticipated",
153+
"content": "February 1, 2022"
154+
},
155+
"location": {
156+
"contact": {
157+
"phone": "646-501-9648",
158+
"last_name": "Fatmira Curovic",
159+
"email": "fatmira.curovic@nyumc.org"
160+
},
161+
"facility": {
162+
"address": {
163+
"zip": "10016",
164+
"country": "United States",
165+
"city": "New York",
166+
"state": "New York"
167+
},
168+
"name": "NYU School of Medicine"
169+
},
170+
"status": "Recruiting",
171+
"contact_backup": {
172+
"last_name": "Binita Shah, MD"
173+
}
174+
},
175+
"intervention": {
176+
"intervention_type": "Drug",
177+
"arm_group_label": [
178+
"Colchicine",
179+
"Placebo"
180+
],
181+
"description": "Participants in the main CLEAR SYNERGY trial are randomized to colchicine/spironolactone versus placebo in a 2x2 factorial design. The substudy is interested in the evaluation of biospecimens obtained from patients in the colchicine vs placebo group.",
182+
"intervention_name": "Colchicine Pill"
183+
},
184+
"patient_data": {
185+
"sharing_ipd": "No"
186+
},
187+
"verification_date": "September 2019"
188+
}
189+
}

0 commit comments

Comments
 (0)