### Question:
DoseUnit extends AbstractEntity implements TypeWithDuration { public static double convert(final double quantity, final DoseUnit from, final DoseUnit to) { double fromMillis = from.getPerTime().getTimeInMillis(new Date(0)); double toMillis = to.getPerTime().getTimeInMillis(new Date(0)); double scale = from.d_scaleModifier.getFactor() / to.d_scaleModifier.getFactor(); return quantity * scale * (toMillis / fromMillis); } DoseUnit(final Unit u, final ScaleModifier scaleMod, final Duration perTime); @Override Set<? extends Entity> getDependencies(); Unit getUnit(); ScaleModifier getScaleModifier(); Duration getPerTime(); void setUnit(final Unit unit); void setScaleModifier(final ScaleModifier scaleMod); void setPerTime(final Duration perTime); @Override String getLabel(); @Override boolean equals(final Object other); @Override boolean deepEquals(final Entity other); @Override DoseUnit clone(); @Override String toString(); @Override Duration getDuration(); @Override void setDuration(final Duration duration); static double convert(final double quantity, final DoseUnit from, final DoseUnit to); static DoseUnit createDefault(); static DoseUnit createMilliGramsPerDay(); static final String PROPERTY_SCALE_MODIFIER; static final String PROPERTY_UNIT; static final String PROPERTY_PER_TIME; }### Answer:
@Test public void testConvert() { assertEquals(0.0001, DoseUnit.convert(2400, DoseUnit.createMilliGramsPerDay(), ExampleData.KILOGRAMS_PER_HOUR), Precision.EPSILON); DoseUnit gHour = new DoseUnit(new Unit("gram", "g"), ScaleModifier.UNIT, EntityUtil.createDuration("PT1H")); assertEquals(240000, DoseUnit.convert(10, gHour, DoseUnit.createMilliGramsPerDay()), Precision.EPSILON); }