[jboss-cvs] jboss-seam/examples/dvdstore/src/com/jboss/dvd/seam/test ...
Norman Richards
norman.richards at jboss.com
Tue Dec 26 12:32:48 EST 2006
User: nrichards
Date: 06/12/26 12:32:48
Modified: examples/dvdstore/src/com/jboss/dvd/seam/test
BestSellersTest.java StoreManagerTest.java
Log:
fix unit tests for big decimal
Revision Changes Path
1.5 +7 -8 jboss-seam/examples/dvdstore/src/com/jboss/dvd/seam/test/BestSellersTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BestSellersTest.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/dvdstore/src/com/jboss/dvd/seam/test/BestSellersTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- BestSellersTest.java 2 Nov 2006 01:09:41 -0000 1.4
+++ BestSellersTest.java 26 Dec 2006 17:32:48 -0000 1.5
@@ -5,6 +5,7 @@
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertTrue;
+import java.math.BigDecimal;
import java.util.List;
import javax.faces.model.ListDataModel;
@@ -47,9 +48,9 @@
// 14.98/29.99/39.95
- assertEquals("price 1", 14.98f, products.get(0).getPrice());
- assertEquals("price 2", 29.99f, products.get(1).getPrice());
- assertEquals("price 3", 39.95f, products.get(2).getPrice());
+ assertEquals("price 1", new BigDecimal("14.98"), products.get(0).getPrice());
+ assertEquals("price 2", new BigDecimal("29.99"), products.get(1).getPrice());
+ assertEquals("price 3", new BigDecimal("39.95"), products.get(2).getPrice());
}
}.run();
}
@@ -65,8 +66,6 @@
ListDataModel model = (ListDataModel) getInstance("topProducts");
model.setRowIndex(1);
- System.out.println("**** PRODUCT" + ((Product)model.getRowData()).getProductId());
-
BestSellers best = (BestSellers) getInstance("bestsellers");
best.addToCart();
}
@@ -78,7 +77,7 @@
assertFalse("cart shouldn't be empty",
cart.getIsEmpty());
assertEquals("cart size", 1, cart.getCart().size());
- assertEquals("cart total", 29.99f, cart.getSubtotal());
+ assertEquals("cart total", new BigDecimal("29.99"), cart.getSubtotal());
}
}.run();
@@ -100,7 +99,7 @@
assertFalse("cart shouldn't be empty",
cart.getIsEmpty());
assertEquals("cart size", 2, cart.getCart().size());
- assertEquals("cart total", 69.94f, cart.getSubtotal());
+ assertEquals("cart total", new BigDecimal("69.94"), cart.getSubtotal());
}
}.run();
@@ -123,7 +122,7 @@
// still two items, but total increase
assertEquals("cart size", 2, cart.getCart().size());
- assertEquals("cart total", 99.93f, cart.getSubtotal());
+ assertEquals("cart total", new BigDecimal("99.93"), cart.getSubtotal());
}
}.run();
1.4 +3 -1 jboss-seam/examples/dvdstore/src/com/jboss/dvd/seam/test/StoreManagerTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StoreManagerTest.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/dvdstore/src/com/jboss/dvd/seam/test/StoreManagerTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- StoreManagerTest.java 2 Nov 2006 01:09:41 -0000 1.3
+++ StoreManagerTest.java 26 Dec 2006 17:32:48 -0000 1.4
@@ -2,6 +2,8 @@
import static org.testng.AssertJUnit.assertEquals;
+import java.math.BigDecimal;
+
import org.jboss.seam.mock.SeamTest;
import org.testng.annotations.Test;
@@ -27,7 +29,7 @@
{
// these are from order instances -
assertEquals("number orders", 0L, manager.getNumberOrders());
- assertEquals("total sales", 0.0, manager.getTotalSales());
+ assertEquals("total sales", BigDecimal.ZERO, manager.getTotalSales());
// these are from inventory
assertEquals("units sold", 5734, manager.getUnitsSold());
More information about the jboss-cvs-commits
mailing list