QuoteUtil { public static BigDecimal getBigDecimalValue(Ticker ticker, double value) { return roundPrice(new BigDecimal(value), ticker.getMinimumTickSize()); }  static BigDecimal getBigDecimalValue(Ticker ticker, double value); static BigDecimal getBigDecimalValue(int value); static BigDecimal roundPrice(BigDecimal price, BigDecimal ticksize); static BigDecimal roundPrice(BigDecimal price, BigDecimal ticksize, int decimalPlaces);  }
@Test public void testGetBigDecimalValue() { Ticker ticker = new StockTicker("ABC"); double value = 1.25; BigDecimal bdValue = QuoteUtil.getBigDecimalValue(ticker, value); BigDecimal expected = new BigDecimal("1.25").setScale(2, RoundingMode.HALF_UP); assertEquals( expected, bdValue); }
@Test public void testGetBigDecimalIntValue() { int value = 5; BigDecimal actual = QuoteUtil.getBigDecimalValue(value); BigDecimal expected = new BigDecimal(5).setScale(0, RoundingMode.HALF_UP); assertEquals( expected, actual ); }