Search in sources :

Example 31 with Money

use of org.javamoney.moneta.Money in project tutorials by eugenp.

the class JavaMoneyUnitManualTest method givenCurrencies_whenCompared_thanNotequal.

@Test
public void givenCurrencies_whenCompared_thanNotequal() {
    MonetaryAmount oneDolar = Monetary.getDefaultAmountFactory().setCurrency("USD").setNumber(1).create();
    Money oneEuro = Money.of(1, "EUR");
    assertFalse(oneEuro.equals(FastMoney.of(1, "EUR")));
    assertTrue(oneDolar.equals(Money.of(1, "USD")));
}
Also used : FastMoney(org.javamoney.moneta.FastMoney) Money(org.javamoney.moneta.Money) MonetaryAmount(javax.money.MonetaryAmount) Test(org.junit.Test)

Aggregations

Money (org.javamoney.moneta.Money)31 AttributeMoney (life.genny.qwanda.attribute.AttributeMoney)7 CurrencyUnit (javax.money.CurrencyUnit)4 MonetaryAmount (javax.money.MonetaryAmount)4 FastMoney (org.javamoney.moneta.FastMoney)4 Test (org.junit.Test)4 BaseEntity (life.genny.qwanda.entity.BaseEntity)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Scanner (java.util.Scanner)2 Answer (life.genny.qwanda.Answer)2 QRules (life.genny.rules.QRules)2 Test (org.testng.annotations.Test)2 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 CurrencyConversion (javax.money.convert.CurrencyConversion)1 ExchangeRateProvider (javax.money.convert.ExchangeRateProvider)1 MonetaryAmountFormat (javax.money.format.MonetaryAmountFormat)1 AttributeBoolean (life.genny.qwanda.attribute.AttributeBoolean)1