assertNotNull( "items=null", items );
assertEquals( "items.size", 2, items.size( ) );
for ( Iterator it = items.iterator( ); it.hasNext( ); )
{
CartItem item = ( CartItem ) it.next( );
if ( "EST-1".equals( item.getItemId( ) ) )
{
assertEquals( "item[EST-1].name", "Angelfish", item.getName( ) );
assertEquals( "item[EST-1].description", "Large", item.getDescription( ) );
assertEquals( "item[EST-1].productId", "FI-SW-01", item.getProductId( ) );
assertEquals( "item[EST-1].unitCost", 16.50, item.getUnitCost( ), 0 );
assertEquals( "item[EST-1].quantity", 10, item.getQuantity( ) );
assertEquals( "item[EST-1].totalCost", 165.0, item.getTotalCost( ), 0 );
}
else if ( "EST-10".equals( item.getItemId( ) ) )
{
assertEquals( "item[EST-10].name", "Bulldog", item.getName( ) );
assertEquals( "item[EST-10].description", "Spotless Female Puppy", item.getDescription( ) );
assertEquals( "item[EST-10].productId", "K9-BD-01", item.getProductId( ) );
assertEquals( "item[EST-10].unitCost", 28.50, item.getUnitCost( ), 0 );
assertEquals( "item[EST-10].quantity", 11, item.getQuantity( ) );
assertEquals( "item[EST-10].totalCost", 313.50, item.getTotalCost( ), 0 );
}
else
{
assertEquals( item.getItemId( ) + " is invalid", false, true );
}
}
// Sub total
assertEquals( "subTotal", 478.5, cart.getTotal( ), 0 );