// Javadoc inherited.
  public void testEqualsAndHashcodeImplementedCorrectly() {

    MutableQuantityValue quantityValue1 = createMutableUnitTypeForTestingEquals();
    MutableQuantityValue quantityValue2 = createMutableUnitTypeForTestingEquals();

    // test that both the values are equal and they have the same hash codes
    assertEquals("Object 1 should be equal to object 2", quantityValue1, quantityValue2);
    MetaDataTestCaseHelper.ensureHashcodesEqual(quantityValue1, quantityValue2);

    // change the magnitude
    final MutableNumberValueImpl magnitudeValue = new MutableNumberValueImpl();
    magnitudeValue.setValue(new Integer(123));
    quantityValue2.setMagnitudeValue(magnitudeValue);
    MetaDataTestCaseHelper.assertNotEquals(quantityValue1, quantityValue2);
    MetaDataTestCaseHelper.ensureHashcodesNotEqual(quantityValue1, quantityValue2);

    // now reset
    quantityValue2 = createMutableUnitTypeForTestingEquals();

    // change the type
    magnitudeValue.setValue(new Long(123));
    quantityValue2.setMagnitudeValue(magnitudeValue);
    MetaDataTestCaseHelper.assertNotEquals(quantityValue1, quantityValue2);
    MetaDataTestCaseHelper.ensureHashcodesNotEqual(quantityValue1, quantityValue2);
  }
  /**
   * Helper method which creates a <code>MutableUnitType</code> which can be used for testing.
   *
   * @return a mutable unit type.
   */
  private MutableQuantityValue createMutableUnitTypeForTestingEquals() {
    MutableQuantityValue mutableQuantityValue = new MutableQuantityValueImpl();

    NumberValueImpl numberValue = new MutableNumberValueImpl();
    mutableQuantityValue.setMagnitudeValue(numberValue);

    UnitValueImpl unitValue = new ImmutableUnitValueImpl();
    mutableQuantityValue.setUnitValue(unitValue);

    return mutableQuantityValue;
  }
  /** This tests the getMagnitudeValueAsNumber method. */
  public void testGetMagnitudeValueAsNumber() {
    MutableQuantityValue mutableQuantityValue = new MutableQuantityValueImpl();

    NumberValueImpl numberValue = new MutableNumberValueImpl();
    numberValue.setValue(new Double(10));
    mutableQuantityValue.setMagnitudeValue(numberValue);

    UnitValue unitValue = QuantityUnits.CENTIMETERS;
    mutableQuantityValue.setUnitValue(unitValue);

    Number expectedResultInMillimeters = new Double(100);
    Number result = mutableQuantityValue.getMagnitudeAsNumber(QuantityUnits.MILLIMETERS);

    assertEquals("CM to MM Conversion failure", expectedResultInMillimeters, result);

    // todo add tests for other conversions
  }