@Test
public void testTraceOnStackTraceElementWithStartAndEnd() {

  final Thread th = Thread.currentThread();
  final StackTraceElement[] elements = th.getStackTrace();
  final int start = 0;
  final int end = elements.length;
  assertNull(ExceptionUtils.trace(null, start, end));
  try {
    ExceptionUtils.trace(elements, start - 1, end);
  } catch (Exception e) {
    assertSame(ArrayIndexOutOfBoundsException.class, e.getClass());
  }
  try {
    ExceptionUtils.trace(elements, start, end + 1);
  } catch (Exception e) {
    assertSame(ArrayIndexOutOfBoundsException.class, e.getClass());
  }
  try {
    ExceptionUtils.trace(elements, start - 1, end + 1);
  } catch (Exception e) {
    assertSame(ArrayIndexOutOfBoundsException.class, e.getClass());
  }
  assertNotNull(ExceptionUtils.trace(elements, start, end));
}