Util { public static int roundLot( int size, int minimumSize) { if( minimumSize == 0 ) { throw new SumZeroException("Cannot divide by zero"); } int increments = (int) Math.round((double) size / (double) minimumSize); return increments * minimumSize; }  static int roundLot( int size, int minimumSize); static String parseTicker(String ticker);  }
@Test public void testRoundLot_invalidRounding() throws Exception { try { Util.roundLot(499, 0); fail(); } catch (SumZeroException ex) { } }
@Test public void testRoundLot() { assertEquals(24000, Util.roundLot(23864, 2000) ); }