### Question:
Interval implements ParamHandler { public int translate(int index) { return translate(index, true); } Interval();  Interval(final int start, final int length); boolean contains(int index); int getLength(); void setLength(final int length); int getStart(); void setStart(final int start); int size(); int translate(int index); int translate(int index, boolean check); int inverseTranslate(int index); int inverseTranslate(int index, boolean check); @Override ParamSet getParams(); @Override void setParams(final ParamSet paramSet); @Override String toString(); int getEnd(); static final String START_FLAG; static final String LENGTH_FLAG; }### Answer:
@Test public void testTranslate() { for(int i = 0; i < length; i++) { final int index = interval.translate(i); Assert.assertEquals(i + start, index); } }
@Test(expected = ArrayIndexOutOfBoundsException.class) public void testTranslateOutOfBoundsAbove() { interval.translate(length); }
@Test(expected = ArrayIndexOutOfBoundsException.class) public void testTranslateOutOfBoundsBelow() { interval.translate(-1); }