Package junit.samples.money

Examples of junit.samples.money.Money


    assertTrue(!fMB1.equals(f12CHF));
    assertTrue(!f12CHF.equals(fMB1));
    assertTrue(!fMB1.equals(fMB2));
  }
  @Test public void testMoneyBagHash() {
    IMoney equal= MoneyBag.create(new Money(12, "CHF"), new Money(7, "USD"));
    assertEquals(fMB1.hashCode(), equal.hashCode());
  }
View Full Code Here


    IMoney equal= MoneyBag.create(new Money(12, "CHF"), new Money(7, "USD"));
    assertEquals(fMB1.hashCode(), equal.hashCode());
  }
  @Test public void testMoneyEquals() {
    assertTrue(!f12CHF.equals(null));
    Money equalMoney= new Money(12, "CHF");
    assertEquals(f12CHF, f12CHF);
    assertEquals(f12CHF, equalMoney);
    assertEquals(f12CHF.hashCode(), equalMoney.hashCode());
    assertTrue(!f12CHF.equals(f14CHF));
  }
View Full Code Here

    assertEquals(f12CHF, equalMoney);
    assertEquals(f12CHF.hashCode(), equalMoney.hashCode());
    assertTrue(!f12CHF.equals(f14CHF));
  }
  @Test public void zeroMoniesAreEqualRegardlessOfCurrency() {
       Money zeroDollars= new Money(0, "USD");
       Money zeroFrancs= new Money(0, "CHF");
       
       assertEquals(zeroDollars, zeroFrancs);
       assertEquals(zeroDollars.hashCode(), zeroFrancs.hashCode());
    }
View Full Code Here

       assertEquals(zeroDollars, zeroFrancs);
       assertEquals(zeroDollars.hashCode(), zeroFrancs.hashCode());
    }
  @Test public void testMoneyHash() {
    assertTrue(!f12CHF.equals(null));
    Money equal= new Money(12, "CHF");
    assertEquals(f12CHF.hashCode(), equal.hashCode());
  }
View Full Code Here

    assertTrue(!f12CHF.equals(null));
    Money equal= new Money(12, "CHF");
    assertEquals(f12CHF.hashCode(), equal.hashCode());
  }
  @Test public void testSimplify() {
    IMoney money= MoneyBag.create(new Money(26, "CHF"), new Money(28, "CHF"));
    assertEquals(new Money(54, "CHF"), money);
  }
View Full Code Here

    IMoney money= MoneyBag.create(new Money(26, "CHF"), new Money(28, "CHF"));
    assertEquals(new Money(54, "CHF"), money);
  }
  @Test public void testNormalize2() {
    // {[12 CHF][7 USD]} - [12 CHF] == [7 USD]
    Money expected= new Money(7, "USD");
    assertEquals(expected, fMB1.subtract(f12CHF));
  }
View Full Code Here

    Money expected= new Money(7, "USD");
    assertEquals(expected, fMB1.subtract(f12CHF));
  }
  @Test public void testNormalize3() {
    // {[12 CHF][7 USD]} - {[12 CHF][3 USD]} == [4 USD]
    IMoney ms1= MoneyBag.create(new Money(12, "CHF"), new Money(3, "USD"));
    Money expected= new Money(4, "USD");
    assertEquals(expected, fMB1.subtract(ms1));
  }
View Full Code Here

    IMoney ms1= MoneyBag.create(new Money(12, "CHF"), new Money(3, "USD"));
    Money expected= new Money(4, "USD");
    assertEquals(expected, fMB1.subtract(ms1));
  }
  @Test public void testNormalize4() { // [12 CHF] - {[12 CHF][3 USD]} == [-3 USD]
    IMoney ms1= MoneyBag.create(new Money(12, "CHF"), new Money(3, "USD"));
    Money expected= new Money(-3, "USD");
    assertEquals(expected, f12CHF.subtract(ms1));
  }
View Full Code Here

  @Test public void testPrint() {
    assertEquals("[12 CHF]", f12CHF.toString());
  }
  @Test public void testSimpleAdd() {
    // [12 CHF] + [14 CHF] == [26 CHF]
    Money expected= new Money(26, "CHF");
    assertEquals(expected, f12CHF.add(f14CHF));
  }
View Full Code Here

    Money expected= new Money(26, "CHF");
    assertEquals(expected, f12CHF.add(f14CHF));
  }
  @Test public void testSimpleBagAdd() {
    // [14 CHF] + {[12 CHF][7 USD]} == {[26 CHF][7 USD]}
    IMoney expected= MoneyBag.create(new Money(26, "CHF"), new Money(7, "USD"));
    assertEquals(expected, f14CHF.add(fMB1));
  }
View Full Code Here

TOP

Related Classes of junit.samples.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.