GridHelper { public static GridBuilder createGrid() { return new GridBuilder(); } private  GridHelper(); static GridBuilder createGrid();  }
@Test public void testSimpleCase() { GridProperties grid = GridHelper.createGrid().ofSize(10) .toFitIn(100) .forValueRange(new Range<Double>(0d, 100d)) .build(); assertNotNull(grid); assertEquals(10, grid.getValueChangePerGridLine(), ALLOWABLE_ERROR); }
@Test public void testSmallRange() { GridProperties grid = GridHelper.createGrid().ofSize(10) .toFitIn(100) .forValueRange(new Range<Double>(0d, 1.2d)) .build(); assertNotNull(grid); assertEquals(0.1, grid.getValueChangePerGridLine(), ALLOWABLE_ERROR); }
@Test public void testSmallRangeWithOffset() { GridProperties grid = GridHelper.createGrid().ofSize(10) .toFitIn(100) .forValueRange(new Range<Double>(0.05d, 1.2d)) .build(); assertNotNull(grid); assertEquals(0.1, grid.getValueChangePerGridLine(), ALLOWABLE_ERROR); }
@Test public void testLargeRange() { GridProperties grid = GridHelper.createGrid().ofSize(40) .toFitIn(100) .forValueRange(new Range<Double>(100d, 12000d)) .build(); assertNotNull(grid); assertEquals(2000, grid.getValueChangePerGridLine(), ALLOWABLE_ERROR); }