### Question:
SizeDouble implements IHasDimensionDouble { @Nonnull @CheckReturnValue public SizeDouble getBestMatchingSize (@Nonnegative final double dMaxWidth, @Nonnegative final double dMaxHeight) { ValueEnforcer.isGT0 (dMaxWidth, "MaxWidth"); ValueEnforcer.isGT0 (dMaxHeight, "MaxHeight"); final double dRelWidth = m_dWidth / dMaxWidth; final double dRelHeight = m_dHeight / dMaxHeight; if (dRelWidth > dRelHeight) { if (m_dWidth > dMaxWidth) return new SizeDouble (dMaxWidth, m_dHeight / dRelWidth); } else { if (m_dHeight > dMaxHeight) return new SizeDouble (m_dWidth / dRelHeight, dMaxHeight); } return this; } SizeDouble(@Nonnull final IHasDimensionInt aObj);  SizeDouble(@Nonnull final IHasDimensionLong aObj);  SizeDouble(@Nonnull final IHasDimensionFloat aObj);  SizeDouble(@Nonnull final IHasDimensionDouble aObj);  SizeDouble(@Nonnegative final double dWidth, @Nonnegative final double dHeight); @Nonnegative double getWidth(); @Nonnegative double getHeight(); @Nonnull @CheckReturnValue SizeDouble getBestMatchingSize(@Nonnegative final double dMaxWidth, @Nonnegative final double dMaxHeight); @Nonnull @CheckReturnValue SizeDouble getScaledToWidth(@Nonnegative final double dNewWidth); @Nonnull @CheckReturnValue SizeDouble getScaledToHeight(@Nonnegative final double dNewHeight); @Nonnull @CheckReturnValue SizeDouble getAdded(@Nonnull final IHasDimensionInt aToAdd); @Nonnull @CheckReturnValue SizeDouble getAdded(@Nonnull final IHasDimensionFloat aToAdd); @Nonnull @CheckReturnValue SizeDouble getAdded(@Nonnull final IHasDimensionDouble aToAdd); @Nonnull @CheckReturnValue SizeDouble getSubtracted(@Nonnull final IHasDimensionInt aToSubtract); @Nonnull @CheckReturnValue SizeDouble getSubtracted(@Nonnull final IHasDimensionFloat aToSubtract); @Nonnull @CheckReturnValue SizeDouble getSubtracted(@Nonnull final IHasDimensionDouble aToSubtract); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test @SuppressFBWarnings ("RV_RETURN_VALUE_IGNORED") public void testGetBestMatchingSize () { final SizeDouble aID = new SizeDouble (320, 240); SizeDouble aID2 = aID.getBestMatchingSize (160, 180); CommonsAssert.assertEquals (160, aID2.getWidth ()); CommonsAssert.assertEquals (120, aID2.getHeight ()); aID2 = aID.getBestMatchingSize (260, 120); CommonsAssert.assertEquals (160, aID2.getWidth ()); CommonsAssert.assertEquals (120, aID2.getHeight ()); aID2 = aID.getBestMatchingSize (48, 120); CommonsAssert.assertEquals (48, aID2.getWidth ()); CommonsAssert.assertEquals (36, aID2.getHeight ()); assertEquals (aID, aID.getBestMatchingSize (640, 481)); assertEquals (aID, aID.getBestMatchingSize (641, 480)); try { aID2.getBestMatchingSize (0, 100); fail (); } catch (final IllegalArgumentException ex) {} try { final SizeDouble aSize = aID2.getBestMatchingSize (100, 0); fail (); assertNull (aSize); } catch (final IllegalArgumentException ex) {} }