@Test
public void testBuildReferenceWeightComposition()
{

  final DateTime testTimestamp = new DateTime(2013, 11, 28, 16, 0, 0);
  RequestContextHolder.setContext(
      new RequestContextImpl(
          1L,
          GlobalAuditContext.current(),
          new DateTime(),
          Opt.of(ConstantUserMetadataProvider.createMetadata("1", "First Last"))));
  final MedicationReferenceWeightComposition comp =
      medicationsBo.buildReferenceWeightComposition(10.0, testTimestamp);
  final AnyEventEvent event = comp.getMedicationReferenceBodyWeight().getHistoryHistory().getAnyEvent().get(0);
  assertEquals(new Double(10.0), new Double(event.getWeight().getMagnitude()));
  assertEquals(testTimestamp, DataValueUtils.getDateTime(event.getTime()));
}