Package com.wesabe.api.util.money

Examples of com.wesabe.api.util.money.Money


      assertEquals(zeroEuros, zeroDollars.convert(exchangeRates, EUR, now()));
    }
   
    @Test
    public void itIsLessThanOneDollar() throws Exception {
      Money zeroDollars = new Money(decimal("0.00"), USD);
      Money oneDollar = new Money(decimal("1.00"), USD);
      assertEquals(-1, zeroDollars.compareTo(oneDollar));
    }
View Full Code Here


      assertEquals(-1, zeroDollars.compareTo(oneDollar));
    }
   
    @Test
    public void itIsMoreThanNegativeOneDollar() throws Exception {
      Money zeroDollars = new Money(decimal("0.00"), USD);
      Money negativeOneDollar = new Money(decimal("-1.00"), USD);
      assertEquals(1, zeroDollars.compareTo(negativeOneDollar));
    }
View Full Code Here

      assertEquals(1, zeroDollars.compareTo(negativeOneDollar));
    }
   
    @Test
    public void itIsComparableToZeroDollars() throws Exception {
      Money zeroDollars = new Money(decimal("0.00"), USD);
      assertEquals(0, zeroDollars.compareTo(zeroDollars));
    }
View Full Code Here

      assertEquals(0, zeroDollars.compareTo(zeroDollars));
    }
   
    @Test
    public void itIsNotComparableToZeroEuros() throws Exception {
      Money zeroDollars = new Money(decimal("0.00"), USD);
      Money zeroEuros = new Money(decimal("0.00"), EUR);
      boolean exceptionThrown = false;
      try {
        zeroDollars.compareTo(zeroEuros);
      } catch (CurrencyMismatchException e) {
        exceptionThrown = true;
View Full Code Here

      assertTrue(exceptionThrown);
    }
   
    @Test
    public void itIsComparableToOtherMoneyObjects() throws Exception {
      Comparable<Money> comparableMoney = new Money(decimal("0.00"), USD);
      Money negativeOneDollar = new Money(decimal("-1.00"), USD);
      assertEquals(1, comparableMoney.compareTo(negativeOneDollar));
    }
View Full Code Here

  }

  public static class Negative_One_Dollar {
    @Test
    public void shouldHaveASignOfNegativeOne() throws Exception {
      Money negativeOneDollar = new Money(decimal("-1.00"), USD);
      assertEquals(-1, negativeOneDollar.signum());
    }
View Full Code Here

      assertEquals(-1, negativeOneDollar.signum());
    }

    @Test
    public void shoudlHaveAnAbsoluteValueOfOneDollar() throws Exception {
      Money negativeOneDollar = new Money(decimal("-1.00"), USD);
      Money oneDollar = new Money(decimal("1.00"), USD);
      assertEquals(oneDollar, negativeOneDollar.abs());
    }
View Full Code Here

      assertEquals(oneDollar, negativeOneDollar.abs());
    }
   
    @Test
    public void shouldRenderInAnArbitraryLocale() throws Exception {
      Money negativeOneDollar = new Money(decimal("-1.00"), USD);
      assertEquals("-1,00 $US", negativeOneDollar.toString(Locale.FRANCE));
    }
View Full Code Here

      assertEquals("-1,00 $US", negativeOneDollar.toString(Locale.FRANCE));
    }
   
    @Test
    public void shouldRenderWithoutParenthesesInTheUS() throws Exception {
      Money negativeOneDollar = new Money(decimal("-1.00"), USD);
      assertEquals("-$1.00", negativeOneDollar.toString(Locale.US));
    }
View Full Code Here

  }

  public static class One_Dollar {
    @Test
    public void shouldNotBeZero() throws Exception {
      Money oneDollar = new Money(decimal("1.00"), USD);
      assertFalse(oneDollar.isZero());
    }
View Full Code Here

TOP

Related Classes of com.wesabe.api.util.money.Money

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.