@Test
public void testBuildWarningSearchDtoFromMedication()
{

  //problems with date conversion
  final DateTime start =
      DataValueUtils.getDateTime(DataValueUtils.getDateTime(new DateTime(2013, 3, 25, 12, 0, DateTimeZone.UTC)));
  //mock
  final MedicationDto medicationDto1 = new MedicationDto();
  medicationDto1.setId(1L);
  medicationDto1.setName("Lekadol 20x500mg");
  final MedicationDto medicationDto2 = new MedicationDto();
  medicationDto2.setId(2L);
  medicationDto2.setName("Primotren 20x500mg");
  final HibernateMedicationsDao medicationsDaoMock = mock(HibernateMedicationsDao.class);
  medicationsBo.setMedicationsDao(medicationsDaoMock);
  final MedicationTimingCluster medicationTimingCluster =
      MedicationsTestUtils.buildMedicationTimingCluster(4L, null, null, null, start, null, null);
  final OrderActivity orderActivity1 =
      MedicationsTestUtils.buildTestOrderActivity(
          "Lekadol", 1L, 500.0, "mg", null, null, null, null, 1L, "ORAL", "1", "TBL");
  orderActivity1.setMedicationTiming(medicationTimingCluster);
  final MedicationForWarningsSearchDto warningsSearchDto1 =
      medicationsBo.buildWarningSearchDtoFromMedication(orderActivity1);
  assertEquals((Double)500.0, warningsSearchDto1.getDoseAmount());
  assertEquals("mg", warningsSearchDto1.getDoseUnit());
  assertEquals("1", warningsSearchDto1.getRouteCode());
  final OrderActivity orderActivity2 =
      MedicationsTestUtils.buildTestOrderActivity(
          "Primotren", 1L, null, null, 10.0, "mg", 3.0, "mL", 1L, "ORAL", "1", "TBL");
  orderActivity2.setMedicationTiming(medicationTimingCluster);
  final MedicationForWarningsSearchDto warningsSearchDto2 =
      medicationsBo.buildWarningSearchDtoFromMedication(orderActivity2);
  assertEquals((Double)10.0, warningsSearchDto2.getDoseAmount());
  assertEquals("mg", warningsSearchDto2.getDoseUnit());
  assertEquals("1", warningsSearchDto2.getRouteCode());
}