//-------------------------------------------------------------------------
        public virtual void test_negated()
        {
            MultiCurrencyAmount @base = MultiCurrencyAmount.of(CA1, CA2);
            MultiCurrencyAmount test  = @base.negated();

            assertMCA(test, CA1.negated(), CA2.negated());
            assertEquals(MultiCurrencyAmount.of(CurrencyAmount.zero(Currency.USD), CurrencyAmount.zero(Currency.EUR)).negated(), MultiCurrencyAmount.of(CurrencyAmount.zero(Currency.USD), CurrencyAmount.zero(Currency.EUR)));
            assertEquals(MultiCurrencyAmount.of(CurrencyAmount.of(Currency.USD, -0d), CurrencyAmount.of(Currency.EUR, -0d)).negated(), MultiCurrencyAmount.of(CurrencyAmount.zero(Currency.USD), CurrencyAmount.zero(Currency.EUR)));
        }
Exemple #2
0
 /// <summary>
 /// Returns a copy of this {@code MultiCurrencyAmount} with the specified amount subtracted.
 /// <para>
 /// This subtracts the specified amount from this monetary amount, returning a new object.
 /// If the currency is already present, the amount is subtracted from the existing amount.
 /// If the currency is not yet present, the negated amount is included.
 /// The subtraction uses standard {@code double} arithmetic.
 /// </para>
 /// <para>
 /// This instance is immutable and unaffected by this method.
 ///
 /// </para>
 /// </summary>
 /// <param name="amountToSubtract">  the amount to subtract </param>
 /// <returns> an amount based on this with the specified amount subtracted </returns>
 public MultiCurrencyAmount minus(MultiCurrencyAmount amountToSubtract)
 {
     ArgChecker.notNull(amountToSubtract, "amountToSubtract");
     return(plus(amountToSubtract.negated()));
 }