Commit 94dd7023 authored by Tony Schaller's avatar Tony Schaller

Unit Test implemented for CDA-CH V2 and CDA-CH-LREP

git-svn-id: https://svn.code.sf.net/p/ehealthconnector/code/trunk@1693 e99adb7c-5e35-42fd-8d1b-cdb378af05e8
parent fdff3c99
......@@ -1958,7 +1958,7 @@ public class DemoLrep
{
LaboratoryBatteryOrganizer battery;
LaboratoryObservation obs;
PreviousLaboratoryObservation prevObs;
PreviousObservation prevObs;
Value value;
Code code;
ReferenceRange refRange;
......@@ -1986,7 +1986,7 @@ public class DemoLrep
obs.addInterpretationCode(code);
value = new Value(new java.lang.Double(50.3));
value.setUcumUnit("ml/min");
prevObs = new PreviousLaboratoryObservation(obs,
prevObs = new PreviousObservation(obs,
DateUtil.parseDateyyyyMMddHHmmZZZZ("201505021003+0200"), value, code);
obs.addPreviousObservation(prevObs);
battery.addLaboratoryObservation(obs);
......
......@@ -32,7 +32,7 @@ import org.ehealth_connector.cda.Section;
import org.ehealth_connector.cda.ch.lab.lrep.CdaChLrepV1GeneralReport;
import org.ehealth_connector.cda.ch.lab.lrep.LaboratoryBatteryOrganizer;
import org.ehealth_connector.cda.ch.lab.lrep.LaboratoryObservation;
import org.ehealth_connector.cda.ch.lab.lrep.PreviousLaboratoryObservation;
import org.ehealth_connector.cda.ch.lab.lrep.PreviousObservation;
import org.ehealth_connector.cda.ch.lab.lrep.SpecimenCollectionEntry;
import org.ehealth_connector.cda.ch.lab.lrep.SpecimenReceivedEntry;
import org.ehealth_connector.cda.ch.utils.CdaChUtil;
......@@ -1944,7 +1944,7 @@ public class DemoLrep {
Performer performer) {
LaboratoryBatteryOrganizer battery;
LaboratoryObservation obs;
PreviousLaboratoryObservation prevObs;
PreviousObservation prevObs;
Value value;
Code code;
ReferenceRange refRange;
......@@ -1972,7 +1972,7 @@ public class DemoLrep {
obs.addInterpretationCode(code);
value = new Value(new Double(50.3));
value.setUcumUnit("ml/min");
prevObs = new PreviousLaboratoryObservation(obs,
prevObs = new PreviousObservation(obs,
DateUtil.parseDateyyyyMMddHHmmZZZZ("201505021003+0200"), value, code);
obs.addPreviousObservation(prevObs);
battery.addLaboratoryObservation(obs);
......
......@@ -35,6 +35,7 @@ import org.ehealth_connector.common.Identificator;
import org.ehealth_connector.common.Organization;
import org.ehealth_connector.common.Patient;
import org.ehealth_connector.common.Person;
import org.ehealth_connector.common.ch.enums.ConfidentialityCode;
import org.ehealth_connector.common.enums.CountryCode;
import org.ehealth_connector.common.enums.LanguageCode;
import org.ehealth_connector.common.utils.DateUtil;
......@@ -67,7 +68,7 @@ import org.openhealthtools.mdht.uml.hl7.datatypes.ST;
public class CdaChV2StructuredBody<EClinicalDocument extends ClinicalDocument>
extends AbstractCda<EClinicalDocument> {
private class MyComparator implements Comparator<org.ehealth_connector.cda.Section> {
private class MySectionComparator implements Comparator<org.ehealth_connector.cda.Section> {
/**
*
* Compares two Section on their logical order regarding the
......@@ -108,7 +109,7 @@ public class CdaChV2StructuredBody<EClinicalDocument extends ClinicalDocument>
}
}
private Comparator<org.ehealth_connector.cda.Section> mComparator = new MyComparator();
private Comparator<org.ehealth_connector.cda.Section> mComparator = new MySectionComparator();
public CdaChV2StructuredBody(EClinicalDocument doc) {
super(doc);
......@@ -129,7 +130,7 @@ public class CdaChV2StructuredBody<EClinicalDocument extends ClinicalDocument>
@Override
public void addAuthenticator(org.ehealth_connector.common.Author author) {
Authenticator authenticator = Util.createAuthenticatorFromAuthor(author);
getDoc().getLegalAuthenticator().setTime(EcoreUtil.copy(author.getAuthorMdht().getTime()));
authenticator.setTime(EcoreUtil.copy(author.getAuthorMdht().getTime()));
CdaUtil.addTemplateIdOnce(authenticator, new Identificator("2.16.756.5.30.1.1.10.2.6"));
super.addAuthenticator(authenticator);
}
......@@ -181,6 +182,18 @@ public class CdaChV2StructuredBody<EClinicalDocument extends ClinicalDocument>
return b.toString();
}
/**
* <div class="en">Gets the Confidentially Code</div> <div class="de"></div>
*
* @return code
*/
public ConfidentialityCode getConfidentialityCodeCh() {
if (getDoc().getConfidentialityCode() != null) {
return ConfidentialityCode.getEnum(getDoc().getConfidentialityCode().getCode());
}
return null;
}
public List<LaboratorySpecialtySection> getLaboratorySpecialtySections() {
ArrayList<LaboratorySpecialtySection> retVal = new ArrayList<LaboratorySpecialtySection>();
for (Section item : getMdht().getSections()) {
......@@ -190,11 +203,21 @@ public class CdaChV2StructuredBody<EClinicalDocument extends ClinicalDocument>
return retVal;
}
/**
* Gets the list of all sections in this document.
*
* @return the sections list
*/
public List<org.ehealth_connector.cda.Section> getSections() {
ArrayList<org.ehealth_connector.cda.Section> retVal = new ArrayList<org.ehealth_connector.cda.Section>();
for (Section item : getMdht().getSections()) {
retVal.add(new org.ehealth_connector.cda.Section(item.getTitle().getText(),
item.getText().getText()));
String title = null;
String text = null;
if (item.getTitle() != null)
title = item.getTitle().getText();
if (item.getText() != null)
text = item.getText().getText();
retVal.add(new org.ehealth_connector.cda.Section(title, text));
}
retVal.sort(mComparator);
return retVal;
......
......@@ -24,7 +24,6 @@ import org.ehealth_connector.cda.ihe.lab.NotificationOrganizer;
import org.ehealth_connector.cda.ihe.lab.OutbreakIdentificationObservation;
import org.ehealth_connector.cda.utils.CdaUtil;
import org.ehealth_connector.common.Code;
import org.ehealth_connector.common.Identificator;
import org.ehealth_connector.common.enums.StatusCode;
import org.openhealthtools.mdht.uml.cda.Act;
import org.openhealthtools.mdht.uml.cda.EntryRelationship;
......@@ -101,20 +100,6 @@ public class BaseChSpecimenAct extends org.ehealth_connector.cda.ihe.lab.BaseLab
setNonHumanSubject(nonHumanSubject);
}
// /**
// * Adds the laboratory battery organizer.
// *
// * @param laboratoryBatteryOrganizer
// * the laboratory battery organizer
// */
// public void addLaboratoryBatteryOrganizer(
// LaboratoryBatteryOrganizer laboratoryBatteryOrganizer) {
// getMdht().addOrganizer(laboratoryBatteryOrganizer.copy());
// // Set the right type for the entryRelationship
// CdaUtil.setEntryRelationshipTypeCode(getMdht().getEntryRelationships(),
// x_ActRelationshipEntryRelationship.COMP);
// }
//
/**
* Adds the laboratory battery organizer.
*
......@@ -124,7 +109,6 @@ public class BaseChSpecimenAct extends org.ehealth_connector.cda.ihe.lab.BaseLab
public void addLaboratoryBatteryOrganizer(
org.ehealth_connector.cda.ch.lab.lrep.LaboratoryBatteryOrganizer laboratoryBatteryOrganizer) {
Organizer organizer = laboratoryBatteryOrganizer.copy();
CdaUtil.addTemplateIdOnce(organizer, new Identificator("2.16.756.5.30.1.1.10.4.19"));
getMdht().addOrganizer(organizer);
// Set the right type for the entryRelationship
CdaUtil.setEntryRelationshipTypeCode(getMdht().getEntryRelationships(),
......
......@@ -51,6 +51,7 @@ public class LaboratoryBatteryOrganizer extends BaseLaboratoryBatteryOrganizer {
*/
public LaboratoryBatteryOrganizer() {
super();
CdaUtil.addTemplateIdOnce(getMdht(), new Identificator("2.16.756.5.30.1.1.10.4.19"));
}
/**
......@@ -83,6 +84,7 @@ public class LaboratoryBatteryOrganizer extends BaseLaboratoryBatteryOrganizer {
public LaboratoryBatteryOrganizer(
org.openhealthtools.mdht.uml.cda.ihe.lab.LaboratoryBatteryOrganizer mdht) {
super(mdht);
CdaUtil.addTemplateIdOnce(getMdht(), new Identificator("2.16.756.5.30.1.1.10.4.19"));
}
/**
......@@ -124,7 +126,6 @@ public class LaboratoryBatteryOrganizer extends BaseLaboratoryBatteryOrganizer {
*/
public void addLaboratoryObservation(LaboratoryObservation observation) {
org.openhealthtools.mdht.uml.cda.ihe.lab.LaboratoryObservation mdht = observation.copy();
CdaUtil.addTemplateIdOnce(mdht, new Identificator("2.16.756.5.30.1.1.10.4.3"));
getMdht().addObservation(mdht);
final int nb = getMdht().getComponents().size() - 1;
......@@ -175,6 +176,19 @@ public class LaboratoryBatteryOrganizer extends BaseLaboratoryBatteryOrganizer {
getMdht().getPerformers().add(mPerformer);
}
/**
* Gets the list of authors.
*
* @return the list of authors
*/
public List<Author> getAuthors() {
List<Author> retVal = new ArrayList<Author>();
for (org.openhealthtools.mdht.uml.cda.Author author : getMdht().getAuthors()) {
retVal.add(new Author(author));
}
return retVal;
}
/**
* Gets the laboratory observations.
*
......@@ -196,7 +210,7 @@ public class LaboratoryBatteryOrganizer extends BaseLaboratoryBatteryOrganizer {
*
* @return the laboratory observations
*/
public List<LaboratoryObservation> getLrqcLaboratoryObservations() {
public List<LaboratoryObservation> getLrepLaboratoryObservations() {
final List<LaboratoryObservation> loList = new ArrayList<LaboratoryObservation>();
for (final org.openhealthtools.mdht.uml.cda.ihe.lab.LaboratoryObservation lo : getMdht()
.getLaboratoryObservations()) {
......@@ -218,6 +232,19 @@ public class LaboratoryBatteryOrganizer extends BaseLaboratoryBatteryOrganizer {
return ol;
}
/**
* Gets the list of performers.
*
* @return the list of performers
*/
public List<Performer> getPerformers() {
List<Performer> retVal = new ArrayList<Performer>();
for (Performer2 performer : getMdht().getPerformers()) {
retVal.add(new Performer(performer));
}
return retVal;
}
/**
* Sets the effective time interval.
*
......
......@@ -17,6 +17,8 @@
*/
package org.ehealth_connector.cda.ch.lab.lrep;
import org.ehealth_connector.cda.utils.CdaUtil;
import org.ehealth_connector.common.Identificator;
import org.ehealth_connector.common.enums.ObservationInterpretation;
import org.openhealthtools.mdht.uml.hl7.datatypes.CE;
import org.openhealthtools.mdht.uml.hl7.datatypes.DatatypesFactory;
......@@ -36,6 +38,7 @@ public class LaboratoryObservation
*/
public LaboratoryObservation() {
super();
CdaUtil.addTemplateIdOnce(getMdht(), new Identificator("2.16.756.5.30.1.1.10.4.3"));
}
/**
......@@ -47,6 +50,7 @@ public class LaboratoryObservation
public LaboratoryObservation(
org.openhealthtools.mdht.uml.cda.ihe.lab.LaboratoryObservation mdht) {
super(mdht);
CdaUtil.addTemplateIdOnce(getMdht(), new Identificator("2.16.756.5.30.1.1.10.4.3"));
}
/**
......@@ -66,7 +70,7 @@ public class LaboratoryObservation
}
}
public void addPreviousObservation(PreviousLaboratoryObservation prevObs) {
public void addPreviousObservation(PreviousObservation prevObs) {
super.addPreviousObservation(new LaboratoryObservation(prevObs.getMdht()));
}
}
......@@ -17,9 +17,16 @@
*/
package org.ehealth_connector.cda.ch.lab.lrep;
import java.util.ArrayList;
import java.util.List;
import org.ehealth_connector.cda.ch.lab.BaseChSpecimenAct;
import org.ehealth_connector.cda.ihe.lab.AbstractLaboratoryReportDataProcessingEntry;
import org.ehealth_connector.cda.utils.CdaUtil;
import org.ehealth_connector.common.Identificator;
import org.openhealthtools.mdht.uml.cda.Act;
import org.openhealthtools.mdht.uml.cda.EntryRelationship;
import org.openhealthtools.mdht.uml.cda.ihe.lab.impl.LaboratoryBatteryOrganizerImpl;
/**
* The Class LaboratoryReportDataProcessingEntry.
......@@ -37,6 +44,7 @@ public class LaboratoryReportDataProcessingEntry
*/
public LaboratoryReportDataProcessingEntry() {
super();
CdaUtil.addTemplateIdOnce(getMdht(), new Identificator("2.16.756.5.30.1.1.10.4.4"));
}
/**
......@@ -59,6 +67,18 @@ public class LaboratoryReportDataProcessingEntry
public LaboratoryReportDataProcessingEntry(
org.openhealthtools.mdht.uml.cda.ihe.lab.LaboratoryReportDataProcessingEntry mdht) {
super(mdht);
CdaUtil.addTemplateIdOnce(getMdht(), new Identificator("2.16.756.5.30.1.1.10.4.4"));
}
public List<LaboratoryBatteryOrganizer> getLaboratoryBatteryOrganizers() {
List<LaboratoryBatteryOrganizer> retVal = new ArrayList<LaboratoryBatteryOrganizer>();
for (EntryRelationship er : getMdht().getAct().getEntryRelationships()) {
if (er.getOrganizer() instanceof LaboratoryBatteryOrganizerImpl)
retVal.add(new LaboratoryBatteryOrganizer(
((LaboratoryBatteryOrganizerImpl) er.getOrganizer())));
}
return retVal;
}
/**
......
......@@ -17,12 +17,16 @@
*/
package org.ehealth_connector.cda.ch.lab.lrep;
import java.util.ArrayList;
import java.util.List;
import org.ehealth_connector.cda.ch.lab.BaseChSpecimenAct;
import org.ehealth_connector.cda.ihe.lab.BaseLaboratorySpecialtySection;
import org.ehealth_connector.cda.utils.CdaUtil;
import org.ehealth_connector.common.Code;
import org.ehealth_connector.common.Identificator;
import org.ehealth_connector.common.enums.LanguageCode;
import org.openhealthtools.mdht.uml.cda.Entry;
/**
* The Class LaboratorySpecialtySection.
......@@ -153,6 +157,40 @@ public class LaboratorySpecialtySection extends BaseLaboratorySpecialtySection {
}
/**
* Gets the laboratory battery organizers.
*
* @return the laboratory battery organizers
*/
public List<LaboratoryBatteryOrganizer> getLaboratoryBatteryOrganizers() {
List<LaboratoryBatteryOrganizer> retVal = new ArrayList<LaboratoryBatteryOrganizer>();
for (LaboratoryReportDataProcessingEntry lrdpe : getLaboratoryReportDataProcessingEntries()) {
for (LaboratoryBatteryOrganizer organizer : lrdpe.getLaboratoryBatteryOrganizers()) {
retVal.add(organizer);
}
}
return retVal;
}
/**
* Gets the laboratory report data processing entries.
*
* @return the laboratory report data processing entries
*/
public List<org.ehealth_connector.cda.ch.lab.lrep.LaboratoryReportDataProcessingEntry> getLaboratoryReportDataProcessingEntries() {
List<org.ehealth_connector.cda.ch.lab.lrep.LaboratoryReportDataProcessingEntry> retVal = new ArrayList<org.ehealth_connector.cda.ch.lab.lrep.LaboratoryReportDataProcessingEntry>();
for (Entry entry : getMdht().getEntries()) {
if (entry instanceof org.openhealthtools.mdht.uml.cda.ihe.lab.LaboratoryReportDataProcessingEntry) {
retVal.add(
new org.ehealth_connector.cda.ch.lab.lrep.LaboratoryReportDataProcessingEntry(
(org.openhealthtools.mdht.uml.cda.ihe.lab.LaboratoryReportDataProcessingEntry) entry));
}
}
return retVal;
}
/**
* Gets the laboratory report data processing entry.
*
......
......@@ -24,17 +24,19 @@ import org.ehealth_connector.common.Code;
import org.ehealth_connector.common.Identificator;
import org.ehealth_connector.common.Value;
public class PreviousLaboratoryObservation
public class PreviousObservation
extends org.ehealth_connector.cda.ihe.lab.PreviousLaboratoryObservation {
public PreviousLaboratoryObservation() {
public PreviousObservation() {
super();
CdaUtil.addTemplateIdOnce(getMdht(), new Identificator("2.16.756.5.30.1.1.10.4.22"));
CdaUtil.removeTemplateId(getMdht(), new Identificator("2.16.756.5.30.1.1.10.4.3"));
}
public PreviousLaboratoryObservation(LaboratoryObservation currentObservation, Date timestamp,
public PreviousObservation(LaboratoryObservation currentObservation, Date timestamp,
Value value, Code interpretationCode) {
super(EcoreUtil.copy(currentObservation.getMdht()), timestamp, value, interpretationCode);
CdaUtil.addTemplateIdOnce(getMdht(), new Identificator("2.16.756.5.30.1.1.10.4.22"));
CdaUtil.removeTemplateId(getMdht(), new Identificator("2.16.756.5.30.1.1.10.4.3"));
}
}
......@@ -39,8 +39,6 @@ public class LaboratoryObservation
*/
public LaboratoryObservation() {
super();
// getMdht().getTemplateIds().add(new
// Identificator("2.16.756.5.30.1.1.10.4.3").getIi());
}
/**
......
......@@ -65,9 +65,12 @@ public abstract class CdaChUtil extends CdaUtil {
*/
public static CdaChLrepV1GeneralReport loadCdaChLrepV1GeneralReportFromFile(String filePath)
throws Exception {
return loadCdaChLrepV1GeneralReportFromStream(IOUtils.toInputStream(
IOUtils.toString(new InputStreamReader(new FileInputStream(filePath), "UTF-8")),
Charsets.UTF_8));
CdaChLrepV1GeneralReport retVal = null;
FileInputStream fs = new FileInputStream(filePath);
retVal = loadCdaChLrepV1GeneralReportFromStream(
IOUtils.toInputStream(IOUtils.toString(fs, Charsets.UTF_8)));
fs.close();
return retVal;
}
public static CdaChLrepV1GeneralReport loadCdaChLrepV1GeneralReportFromStream(
......@@ -93,9 +96,11 @@ public abstract class CdaChUtil extends CdaUtil {
*/
public static CdaChV2StructuredBody<org.openhealthtools.mdht.uml.cda.ch.CdaChV2StructuredBody> loadCdaChV2FromFile(
String filePath) throws Exception {
return loadCdaChV2FromStream(IOUtils.toInputStream(
IOUtils.toString(new InputStreamReader(new FileInputStream(filePath), "UTF-8")),
Charsets.UTF_8));
CdaChV2StructuredBody<org.openhealthtools.mdht.uml.cda.ch.CdaChV2StructuredBody> retVal = null;
FileInputStream fs = new FileInputStream(filePath);
retVal = loadCdaChV2FromStream(IOUtils.toInputStream(IOUtils.toString(fs, Charsets.UTF_8)));
fs.close();
return retVal;
}
/**
......
/*
* The authorship of this project and accompanying materials is held by medshare GmbH, Switzerland.
* All rights reserved. https://medshare.net
*
* Source code, documentation and other resources have been contributed by various people.
* Project Team: https://sourceforge.net/p/ehealthconnector/wiki/Team/
* For exact developer information, please refer to the commit history of the forge.
*
* This code is made available under the terms of the Eclipse Public License v1.0.
*
* Accompanying materials are made available under the terms of the Creative Commons
* Attribution-ShareAlike 4.0 License.
*
* This line is intended for UTF-8 encoding checks, do not modify/delete: äöüéè
*
*/
package org.ehealth_connector.cda.ch.lab.lrep;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.Date;
import java.util.List;
import org.ehealth_connector.cda.BaseObservation;
import org.ehealth_connector.cda.ObservationMediaEntry;
import org.ehealth_connector.common.Author;
import org.ehealth_connector.common.Identificator;
import org.ehealth_connector.common.Name;
import org.ehealth_connector.common.Performer;
import org.ehealth_connector.common.enums.StatusCode;
import org.ehealth_connector.common.utils.DateUtil;
import org.junit.Test;
/**
* Unit Tests for Class LaboratoryBatteryOrganizer.
*/
public class LaboratoryBatteryOrganizerTest {
/** The name of the class under test. */
private String cutName = "LaboratoryBatteryOrganizer";
/**
* Test method for
* {@link org.ehealth_connector.cda.ch.lab.lrep.LaboratoryBatteryOrganizer#addAuthor(org.ehealth_connector.common.Author)}.
*/
@Test
public void testAddGetAuthor() {
Name name1 = new Name("John", "Doe");
Name name2 = new Name("Max", "Muster");
LaboratoryBatteryOrganizer lbo = new LaboratoryBatteryOrganizer();
lbo.addAuthor(new Author(name1));
lbo.addAuthor(new Author(name2));
List<Author> authorList = lbo.getAuthors();
assertTrue(authorList.get(0).getName().getFamilyName().equals(name1.getFamilyName()));
assertTrue(authorList.get(1).getName().getAllGivenNames().equals(name2.getAllGivenNames()));
}
/**
* Test method for
* {@link org.ehealth_connector.cda.ch.lab.lrep.LaboratoryBatteryOrganizer#addLaboratoryObservation(org.ehealth_connector.cda.ch.lab.lrep.LaboratoryObservation)}
* and
* {@link org.ehealth_connector.cda.ch.lab.lrep.LaboratoryBatteryOrganizer#getLaboratoryObservations()}
* and
* {@link org.ehealth_connector.cda.ch.lab.lrep.LaboratoryBatteryOrganizer#getLrepLaboratoryObservations()}.
*/
@Test
public void testAddGetLaboratoryObservation() {
LaboratoryObservation obs1 = new LaboratoryObservation();
LaboratoryObservation obs2 = new LaboratoryObservation();
obs1.setText("test1");
obs2.setText("test2");
LaboratoryBatteryOrganizer lbo = new LaboratoryBatteryOrganizer();
lbo.addLaboratoryObservation(obs1);
lbo.addLaboratoryObservation(obs2);
List<BaseObservation> obsList = lbo.getLaboratoryObservations();
assertTrue(obsList.get(0).getText().equals(obs1.getText()));
assertTrue(obsList.get(1).getText().equals(obs2.getText()));
}
/**
* Test method for
* {@link org.ehealth_connector.cda.ch.lab.lrep.LaboratoryBatteryOrganizer#addObservationMediaEntry(org.ehealth_connector.cda.ObservationMediaEntry)}
* and
* {@link org.ehealth_connector.cda.ch.lab.lrep.LaboratoryBatteryOrganizer#getObservationMediaEntries()}.
*/
@Test
public void testAddGetObservationMediaEntry() {
ObservationMediaEntry obsMedia1 = new ObservationMediaEntry();
ObservationMediaEntry obsMedia2 = new ObservationMediaEntry();
obsMedia1.setObservationMediaId("id1");
obsMedia2.setObservationMediaId("id2");
LaboratoryBatteryOrganizer lbo = new LaboratoryBatteryOrganizer();
lbo.addObservationMediaEntry(obsMedia1);
lbo.addObservationMediaEntry(obsMedia2);
List<ObservationMediaEntry> obsMediaList = lbo.getObservationMediaEntries();
assertTrue(obsMediaList.get(0).getObservationMediaId()
.equals(obsMedia1.getObservationMediaId()));
assertTrue(obsMediaList.get(1).getObservationMediaId()
.equals(obsMedia2.getObservationMediaId()));
}
/**
* Test method for
* {@link org.ehealth_connector.cda.ch.lab.lrep.LaboratoryBatteryOrganizer#addPerformer(org.ehealth_connector.common.Performer)}.
*/
@Test
public void testAddGetPerformer() {
Name name1 = new Name("John", "Doe");
Name name2 = new Name("Max", "Muster");
LaboratoryBatteryOrganizer lbo = new LaboratoryBatteryOrganizer();
lbo.addPerformer(new Performer(name1));
lbo.addPerformer(new Performer(name2));
List<Performer> PerformerList = lbo.getPerformers();
assertTrue(PerformerList.get(0).getName().getFamilyName().equals(name1.getFamilyName()));
assertTrue(
PerformerList.get(1).getName().getAllGivenNames().equals(name2.getAllGivenNames()));
}
/**
* Test method for templateIDs in this CDA element
*/
@Test
public void testCheckTemplateIds() {
String idIhe = "1.3.6.1.4.1.19376.1.3.1.4";
boolean idFoundIhe = false;
String idChPalm = "2.16.756.5.30.1.1.10.4.19";
boolean idFoundChPalm = false;
LaboratoryBatteryOrganizer lbo = new LaboratoryBatteryOrganizer();
for (Identificator id : lbo.getTemplateIds()) {
assertNull("Extensions not allowd for template ids", id.getExtension());
if (idIhe.equals(id.getRoot()))
idFoundIhe = true;
if (idChPalm.equals(id.getRoot()))
idFoundChPalm = true;
}
assertTrue(cutName + " templateID defined by IHE XD-LAB is missing", idFoundIhe);
assertTrue(cutName + " templateID defined by ART DECOR CH-PALM is missing", idFoundChPalm);
assertFalse(cutName + " contains more templateIds than expected",
(lbo.getTemplateIds().size() > 2));
}
/**
* Test method for
* {@link org.ehealth_connector.cda.MdhtOrganizerFacade#setEffectiveTime(java.util.Date)}
* and
* {@link org.ehealth_connector.cda.MdhtOrganizerFacade#getEffectiveTime()}
* and
* {@link org.ehealth_connector.cda.ch.lab.lrep.LaboratoryBatteryOrganizer#setEffectiveTime(java.util.Date, java.util.Date)}.
*/
@Test
public void testSetGetEffectiveTimeDate() {
Date date1 = DateUtil.parseDateyyyyMMdd("20180721");
Date date2 = DateUtil.parseDateyyyyMMdd("20180722");
LaboratoryBatteryOrganizer lbo = new LaboratoryBatteryOrganizer();
lbo.setEffectiveTime(date1);
assertTrue(lbo.getEffectiveTime().equals(date1));
assertFalse(lbo.getEffectiveTime().equals(date2));
}
/**
* Test method for