/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package uk.nhs.interoperability.payloads.helpers;
import java.util.Date;
import org.junit.Test;
import uk.nhs.interoperability.payloads.AbstractTest;
import uk.nhs.interoperability.payloads.DateValue;
import uk.nhs.interoperability.payloads.commontypes.Address;
import uk.nhs.interoperability.payloads.commontypes.PersonName;
import uk.nhs.interoperability.payloads.endoflifecarev1.ClinicalDocument;
import uk.nhs.interoperability.payloads.exceptions.MissingMandatoryFieldException;
import uk.nhs.interoperability.payloads.util.PropertyReader;
import uk.nhs.interoperability.payloads.vocabularies.generated.AuthoritytoLPASnCT;
import uk.nhs.interoperability.payloads.vocabularies.generated.DNACPRprefSnCT;
import uk.nhs.interoperability.payloads.vocabularies.generated.EoLADRTprefSnCT;
import uk.nhs.interoperability.payloads.vocabularies.generated.EoLToolSnCT;
import uk.nhs.interoperability.payloads.vocabularies.generated.HumanLanguage;
import uk.nhs.interoperability.payloads.vocabularies.generated.JobRoleName;
import uk.nhs.interoperability.payloads.vocabularies.generated.PrognosisAwarenessSnCT;
import uk.nhs.interoperability.payloads.vocabularies.generated.Sex;
import uk.nhs.interoperability.payloads.vocabularies.internal.DatePrecision;
public class EndOfLifeCareDocumentCreationCDGRSHelperTest extends AbstractTest {
private static EndOfLifeCareISBFields minimal;
private static EndOfLifeCareISBFields full;
static {
minimal = EndOfLifeCareDocumentCreationHelperTest.createMinimal();
full = EndOfLifeCareDocumentCreationHelperTest.createFull();
}
@Test
public void testCreateDocumentMinimal() {
super.init("endoflifecare/", "EOLCHelper-CDGRSserialiseMinimal", "EoLC Helper: CDGRS Minimal Serialise", "This uses the EOLC Helper class to generate a full end of life care CDA document with a minimal set of fields, and serialises to a CDA document, which is compared with an expected document example.");
try {
// Use the helper to create the document
ClinicalDocument doc = EndOfLifeCareDocumentCreationCDGRSHelper.createDocument(minimal);
// Serialise to a CDA XML Document
String xml = doc.serialise();
// Generate the rendered version
super.render(xml);
content = content.replaceAll("#TESTRESULT#", "<div class='pass'>PASS: Successfully created minimal CDA document</div>");
content = content.replaceAll("#EXPECTED#", "");
addActualResultWithXML(xml);
} catch (Exception e) {
super.exception(e);
} finally {
super.writeResults();
}
}
@Test
public void testCreateDocumentFull() {
super.init("endoflifecare/", "EOLCHelper-CDGRSserialiseFull", "EoLC Helper: CDGRS Full Serialise", "This uses the EOLC Helper class to generate a full end of life care CDA document with a full set of fields, and serialises to a CDA document, which is compared with an expected document example.");
try {
// Use the helper to create the document
ClinicalDocument doc = EndOfLifeCareDocumentCreationCDGRSHelper.createDocument(full);
// Serialise to a CDA XML Document
String xml = doc.serialise();
System.out.println(xml);
// Generate the rendered version
super.render(xml);
content = content.replaceAll("#TESTRESULT#", "<div class='pass'>PASS: Successfully created full CDA document</div>");
content = content.replaceAll("#EXPECTED#", "");
addActualResultWithXML(xml);
} catch (Exception e) {
super.exception(e);
} finally {
super.writeResults();
}
}
}