Search in sources :

Example 61 with MonetaryAmount

use of javax.money.MonetaryAmount in project jsr354-ri by JavaMoney.

the class ExtractorMajorPartQueryTest method shouldReturnMajorPartNegative.

@Test
public void shouldReturnMajorPartNegative() {
    MonetaryAmount monetaryAmount = Money.parse("BHD -1.345");
    Long result = query.queryFrom(monetaryAmount);
    Long expected = -1L;
    assertEquals(result, expected);
}
Also used : MonetaryAmount(javax.money.MonetaryAmount) Test(org.testng.annotations.Test)

Example 62 with MonetaryAmount

use of javax.money.MonetaryAmount in project jsr354-ri by JavaMoney.

the class FastMoneyProducerTest method shouldCreateUsingFastMoneyImplementation.

@Test
public void shouldCreateUsingFastMoneyImplementation() {
    Long value = 10L;
    MonetaryAmount amount = producer.create(currency, value);
    assertTrue(FastMoney.class.isInstance(amount));
}
Also used : MonetaryAmount(javax.money.MonetaryAmount) FastMoney(org.javamoney.moneta.FastMoney) Test(org.testng.annotations.Test)

Example 63 with MonetaryAmount

use of javax.money.MonetaryAmount in project jsr354-ri by JavaMoney.

the class ExtractorMinorPartQueryTest method shouldReturnMajorPartNegative.

@Test
public void shouldReturnMajorPartNegative() {
    MonetaryAmount monetaryAmount = Money.parse("BHD -1.345");
    Long result = query.queryFrom(monetaryAmount);
    Long expected = -345L;
    assertEquals(result, expected);
}
Also used : MonetaryAmount(javax.money.MonetaryAmount) Test(org.testng.annotations.Test)

Example 64 with MonetaryAmount

use of javax.money.MonetaryAmount in project jsr354-ri by JavaMoney.

the class ExtractorMinorPartQueryTest method shouldReturnMajorPartPositive.

@Test
public void shouldReturnMajorPartPositive() {
    MonetaryAmount monetaryAmount = Money.parse("EUR 2.35");
    Long result = query.queryFrom(monetaryAmount);
    Long expected = 35L;
    assertEquals(result, expected);
}
Also used : MonetaryAmount(javax.money.MonetaryAmount) Test(org.testng.annotations.Test)

Example 65 with MonetaryAmount

use of javax.money.MonetaryAmount in project jsr354-ri by JavaMoney.

the class MonetaryFunctionsAggregatorTest method shouldMaxCorretly.

@Test
public void shouldMaxCorretly() {
    Stream<MonetaryAmount> stream = StreamFactory.streamNormal();
    MonetaryAmount max = stream.reduce(max()).get();
    Assert.assertTrue(max.getNumber().intValue() == 10);
}
Also used : MonetaryAmount(javax.money.MonetaryAmount) Test(org.testng.annotations.Test)

Aggregations

MonetaryAmount (javax.money.MonetaryAmount)275 Test (org.testng.annotations.Test)260 CurrencyConversion (javax.money.convert.CurrencyConversion)88 BeforeTest (org.testng.annotations.BeforeTest)83 BigDecimal (java.math.BigDecimal)64 CurrencyUnit (javax.money.CurrencyUnit)57 ConversionQuery (javax.money.convert.ConversionQuery)10 RoundedMoney (org.javamoney.moneta.RoundedMoney)10 LocalDate (java.time.LocalDate)9 ExchangeRateProvider (javax.money.convert.ExchangeRateProvider)9 Test (org.junit.Test)9 FastMoney (org.javamoney.moneta.FastMoney)6 Money (org.javamoney.moneta.Money)6 MathContext (java.math.MathContext)4 MonetaryOperator (javax.money.MonetaryOperator)4 MonetaryAmountFormat (javax.money.format.MonetaryAmountFormat)4 MonetaryAmountFactory (javax.money.MonetaryAmountFactory)3 BookingBean (com.github.drbookings.model.data.BookingBean)2 Calendar (java.util.Calendar)2 GregorianCalendar (java.util.GregorianCalendar)2