@Test
public void testBuildWarningSearchDtoFromIngredient()
{

  //problems with date conversion
  final DateTime start =
      DataValueUtils.getDateTime(DataValueUtils.getDateTime(new DateTime(2013, 3, 25, 12, 0, DateTimeZone.UTC)));
  final Map<Long, MedicationHolderDto> medicationHolderMap = new HashMap<>();
  final MedicationHolderDto medicationDto1 = new MedicationHolderDto();
  medicationDto1.setId(1L);
  medicationDto1.setName("Lekadol 20x500mg");
  medicationHolderMap.put(1L, medicationDto1);
  final MedicationHolderDto medicationDto2 = new MedicationHolderDto();
  medicationDto2.setId(2L);
  medicationDto2.setName("Primotren 20x500mg");
  medicationHolderMap.put(2L, medicationDto2);
  final MedicationsValueHolder medicationsValueHolder = mock(MedicationsValueHolder.class);
  when(medicationsValueHolder.getValue()).thenReturn(medicationHolderMap);
  medicationsBo.setMedicationsValueHolder(medicationsValueHolder);
  final MedicationTimingCluster medicationTimingCluster =
      MedicationsTestUtils.buildMedicationTimingCluster(4L, null, null, null, start, null, null);
  final IngredientCluster ingredient1 =
      MedicationsTestUtils.buildTestActiveIngredient("Lekadol", "0001", 500.0, "mg", null, null, null, null);
  final OrderActivity orderActivity1 =
      MedicationsTestUtils.buildTestOrderActivity(null, null, null, null, null, null, null, null, 1L, "ORAL", "1", "TBL");
  orderActivity1.setMedicationTiming(medicationTimingCluster);
  final MedicationForWarningsSearchDto warningsSearchDto1 =
      medicationsBo.buildWarningSearchDtoFromIngredient(orderActivity1, ingredient1);
  assertEquals((Double)500.0, warningsSearchDto1.getDoseAmount());
  assertEquals("mg", warningsSearchDto1.getDoseUnit());
  assertEquals("1", warningsSearchDto1.getRouteCode());
  final IngredientCluster ingredient2 =
      MedicationsTestUtils.buildTestActiveIngredient("Primotren", "0002", null, null, 10.0, "mg", 3.0, "mL");
  final OrderActivity orderActivity2 =
      MedicationsTestUtils.buildTestOrderActivity(null, null, null, null, null, null, null, null, 1L, "ORAL", "1", "TBL");
  orderActivity2.setMedicationTiming(medicationTimingCluster);
  final MedicationForWarningsSearchDto warningsSearchDto2 =
      medicationsBo.buildWarningSearchDtoFromIngredient(orderActivity2, ingredient2);
  assertEquals((Double)10.0, warningsSearchDto2.getDoseAmount());
  assertEquals("mg", warningsSearchDto2.getDoseUnit());
  assertEquals("1", warningsSearchDto2.getRouteCode());
}