### Question:
Scrolling { static int getDelta(Interval vis, Interval target) { if (vis.getLength() < target.getLength()) { return target.getLowerBound() - vis.getLowerBound(); } if (target.getLowerBound() < vis.getLowerBound() || target.getUpperBound() > vis.getUpperBound()) { return target.getUpperBound() - vis.getUpperBound(); } return 0; }  static void scrollTo(Rectangle rect, Element element);  }### Answer:
@Test public void noScrolling() { assertEquals(0, Scrolling.getDelta(new Interval(0, 100), new Interval(5, 50))); }
@Test public void ifFitsAlignRight() { assertEquals(5, Scrolling.getDelta(new Interval(0, 100), new Interval(95, 105))); }
@Test public void ifNotFitAlignLeft() { assertEquals(7, Scrolling.getDelta(new Interval(0, 100), new Interval(7, 110))); }