예제 #1
0
 //-------------------------------------------------------------------------
 public virtual void test_negated()
 {
     assertEquals(CCY_AMOUNT.negated(), CCY_AMOUNT_NEGATIVE);
     assertEquals(CCY_AMOUNT_NEGATIVE.negated(), CCY_AMOUNT);
     assertEquals(CurrencyAmount.zero(Currency.USD), CurrencyAmount.zero(Currency.USD).negated());
     assertEquals(CurrencyAmount.of(Currency.USD, -0d).negated(), CurrencyAmount.zero(Currency.USD));
 }
        //-------------------------------------------------------------------------
        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)));
        }
        public virtual void test_minus_CurrencyAmount_add()
        {
            CurrencyAmount      ca   = CurrencyAmount.of(Currency.AUD, 117);
            CurrencyAmount      cb   = CurrencyAmount.of(Currency.USD, 12);
            CurrencyAmount      cc   = CurrencyAmount.of(Currency.NZD, 3);
            MultiCurrencyAmount mc1  = MultiCurrencyAmount.of(ca, cb);
            MultiCurrencyAmount test = mc1.minus(cc);

            assertMCA(test, ca, cb, cc.negated());
        }
        //-------------------------------------------------------------------------
        public virtual void test_minus_MultiCurrencyAmount_mergeAndAdd()
        {
            CurrencyAmount      ca   = CurrencyAmount.of(Currency.AUD, 117);
            CurrencyAmount      cb   = CurrencyAmount.of(Currency.USD, 12);
            CurrencyAmount      cc   = CurrencyAmount.of(Currency.AUD, 3);
            CurrencyAmount      cd   = CurrencyAmount.of(Currency.NZD, 3);
            MultiCurrencyAmount mc1  = MultiCurrencyAmount.of(ca, cb);
            MultiCurrencyAmount mc2  = MultiCurrencyAmount.of(cc, cd);
            MultiCurrencyAmount test = mc1.minus(mc2);

            assertMCA(test, cb, cd.negated(), CurrencyAmount.of(Currency.AUD, 114));
        }