Exemplo n.º 1
0
 @Test
 public void testInit() {
   // System.out.println("Test init with double");
   Currency currency = new Currency(Currency.CarryType.Two, 32.23);
   Assert.assertEquals(32l, currency.getWhole());
   Assert.assertEquals(23l, currency.getDecimal());
 }
Exemplo n.º 2
0
 @Test
 public void testToString() {
   // System.out.println("Test ToString");
   Assert.assertEquals("125.84", currency2_1.toString());
   Assert.assertEquals("481.23", currency2_2.toString());
   Assert.assertEquals("250.0019", currency4_1.toString());
   Assert.assertEquals("250.9998", currency4_2.toString());
 }
Exemplo n.º 3
0
  @Test
  public void testInit2() {
    // System.out.println("Test init with double");
    Currency currency = new Currency(Currency.CarryType.Two, 0.0);
    Assert.assertEquals(0, currency.getWhole());
    Assert.assertEquals(0, currency.getDecimal());

    currency = new Currency(Currency.CarryType.Two, 555.0);
    Assert.assertEquals(555, currency.getWhole());
    Assert.assertEquals(0, currency.getDecimal());
  }
Exemplo n.º 4
0
 @Test
 public void testAdd() {
   // System.out.println("Test Add");
   Assert.assertEquals("607.07", currency2_1.add(currency2_2).toString());
 }