@Test
public void testSortTherapyTemplates()
{

  final TherapyTemplatesDto templates = new TherapyTemplatesDto();
  final TherapyTemplateDto template = new TherapyTemplateDto();
  final List<TherapyTemplateElementDto> templateElements = new ArrayList<>();
  template.setTemplateElements(templateElements);
  templates.getOrganizationTemplates().add(template);
  final TherapyTemplateElementDto element1 = new TherapyTemplateElementDto();
  final ConstantSimpleTherapyDto therapy1 = new ConstantSimpleTherapyDto();
  therapy1.setTherapyDescription("Lekadol 500mg 1x per day po");
  element1.setTherapy(therapy1);
  template.getTemplateElements().add(element1);
  final TherapyTemplateElementDto element2 = new TherapyTemplateElementDto();
  final ConstantSimpleTherapyDto therapy2 = new ConstantSimpleTherapyDto();
  therapy2.setTherapyDescription("Aspirin 500mg 2x per day po");
  element2.setTherapy(therapy2);
  template.getTemplateElements().add(element2);
  final TherapyTemplateElementDto element3 = new TherapyTemplateElementDto();
  final ConstantComplexTherapyDto therapy3 = new ConstantComplexTherapyDto();
  therapy3.setTherapyDescription("Dopamin 100ml 10ml/h ivk");
  element3.setTherapy(therapy3);
  template.getTemplateElements().add(element3);
  final TherapyTemplateElementDto element4 = new TherapyTemplateElementDto();
  final ConstantComplexTherapyDto therapy4 = new ConstantComplexTherapyDto();
  therapy4.setTherapyDescription("Glucose 500ml Baselie infusion ivk");
  therapy4.setBaselineInfusion(true);
  element4.setTherapy(therapy4);
  template.getTemplateElements().add(element4);
  medicationsBo.sortTherapyTemplates(templates);
  final List<TherapyTemplateElementDto> sortedElements =
      templates.getOrganizationTemplates().get(0).getTemplateElements();
  assertEquals(sortedElements.get(0), element4);
  assertEquals(sortedElements.get(1), element2);
  assertEquals(sortedElements.get(2), element3);
  assertEquals(sortedElements.get(3), element1);
}