### Question:
DurationPresentation extends AbstractObservable { public DateUnits getUnits() { d_data = parseDuration(); return d_data == null ? DEFAULT_DATA.units : d_data.units; } DurationPresentation(T bean); static Data parseDuration(Duration duration, DateUnits prevUnits); DateUnits getUnits(); void setUnits(DateUnits units); int getQuantity(); void setQuantity(int quantity); boolean getDefined(); void setDefined(boolean defined); static Duration generateDuration(String duration); String getLabel(); @Override String toString(); static final String PROPERTY_DEFINED; static final String PROPERTY_DURATION_QUANTITY; static final String PROPERTY_DURATION_UNITS; static final String PROPERTY_LABEL; }### Answer:
@Test public void testGetUnits() throws DatatypeConfigurationException { assertEquals(DateUnits.Weeks, d_pm2.getUnits()); assertEquals(DateUnits.Weeks, d_pm1.getUnits()); assertEquals(DateUnits.Days, d_pm3.getUnits()); d_epoch1.setDuration(DatatypeFactory.newInstance().newDuration("PT3H")); assertEquals(DateUnits.Hours, d_pm1.getUnits()); d_epoch1.setDuration(DatatypeFactory.newInstance().newDuration("PT5M")); assertEquals(DateUnits.Minutes, d_pm1.getUnits()); d_epoch1.setDuration(DatatypeFactory.newInstance().newDuration("PT3S")); assertEquals(DateUnits.Seconds, d_pm1.getUnits()); d_epoch1.setDuration(DatatypeFactory.newInstance().newDuration("P4M")); assertEquals(DateUnits.Months, d_pm1.getUnits()); }