Code example for BigDecimal

Methods: toString

0
 
	private BigDecimalCoercer coercer = new BigDecimalCoercer();
	private Logger logger = Logger.getLogger(getClass());
	@Test 
	public void testBigDecimal() { 
		BigDecimal bd = new BigDecimal("14");
		logger.debug("bd is " + bd.toString());
		assertTrue(bd == coercer.coerce(bd) );
	} 
	@Test 
	public void testFloat() { 
		assertTrue(coercer.coerce(new Float(4.3)).equals(new BigDecimal(new Float(4.3))));
	} 
	@Test 
	public void testDouble() { 
		assertTrue(coercer.coerce(new Double(4.3)).equals(new BigDecimal(new Double(4.3))));
	} 
		 
	@Test 
	public void testInteger() { 
		assertTrue(coercer.coerce(new Integer(4)).equals(new BigDecimal(4)));