/// <summary> /// Assert that the {@code CurrencyAmount} has the same currency as /// the supplied {@code CurrencyAmount} and that the amount is within /// range of the supplied {@code CurrencyAmount}'s amount. /// </summary> /// <param name="expected"> the expected {@code CurrencyAmount} </param> /// <param name="tolerance"> the tolerance to use </param> /// <returns> this if the amount matches the expectation, else /// throw an {@code AssertionError} </returns> public virtual CurrencyAmountAssert isEqualTo(CurrencyAmount expected, Offset <double> tolerance) { NotNull; hasCurrency(expected.Currency); hasAmount(expected.Amount, tolerance); return(this); }
/// <summary> /// Assert that the {@code CurrencyAmount} is within range /// of an expected amount. /// </summary> /// <param name="expectedAmount"> the expected amount </param> /// <param name="tolerance"> the tolerance to use </param> /// <returns> this if the amount matches the expectation, else /// throw an {@code AssertionError} </returns> public virtual CurrencyAmountAssert hasAmount(double expectedAmount, Offset <double> tolerance) { NotNull; Assertions.assertThat(actual.Amount).isEqualTo(expectedAmount, tolerance); return(this); }