### Question:
Handler { static Handler removeRange(final Handler firstHandler, final Label start, final Label end) { if (firstHandler == null) { return null; } else { firstHandler.nextHandler = removeRange(firstHandler.nextHandler, start, end); } int handlerStart = firstHandler.startPc.bytecodeOffset; int handlerEnd = firstHandler.endPc.bytecodeOffset; int rangeStart = start.bytecodeOffset; int rangeEnd = end == null ? Integer.MAX_VALUE : end.bytecodeOffset; if (rangeStart >= handlerEnd || rangeEnd <= handlerStart) { return firstHandler; } if (rangeStart <= handlerStart) { if (rangeEnd >= handlerEnd) { return firstHandler.nextHandler; } else { return new Handler(firstHandler, end, firstHandler.endPc); } } else if (rangeEnd >= handlerEnd) { return new Handler(firstHandler, firstHandler.startPc, start); } else { firstHandler.nextHandler = new Handler(firstHandler, end, firstHandler.endPc); return new Handler(firstHandler, firstHandler.startPc, start); } } Handler(
      final Label startPc,
      final Label endPc,
      final Label handlerPc,
      final int catchType,
      final String catchTypeDescriptor);   Handler(final Handler handler, final Label startPc, final Label endPc);   }### Answer:
@Test public void testRemoveRange_removeAllOrNothing() { Handler handler = newHandler(10, 20); assertEquals(null, Handler.removeRange(null, newLabel(0), newLabel(10))); assertEquals(handler, Handler.removeRange(handler, newLabel(0), newLabel(10))); assertEquals(handler, Handler.removeRange(handler, newLabel(20), newLabel(30))); assertEquals(handler, Handler.removeRange(handler, newLabel(20), null)); assertEquals(null, Handler.removeRange(handler, newLabel(0), newLabel(30))); }
@Test public void testRemoveRange_removeStart() { Handler handler = Handler.removeRange(newHandler(10, 20), newLabel(0), newLabel(15)); assertEquals(15, handler.startPc.bytecodeOffset); assertEquals(20, handler.endPc.bytecodeOffset); assertEquals(null, handler.nextHandler); }
@Test public void testRemoveRange_removeEnd() { Handler handler = Handler.removeRange(newHandler(10, 20), newLabel(15), newLabel(30)); assertEquals(10, handler.startPc.bytecodeOffset); assertEquals(15, handler.endPc.bytecodeOffset); assertEquals(null, handler.nextHandler); }
@Test public void testRemoveRange_removeMiddle() { Handler handler = Handler.removeRange(newHandler(10, 20), newLabel(13), newLabel(17)); assertEquals(10, handler.startPc.bytecodeOffset); assertEquals(13, handler.endPc.bytecodeOffset); assertEquals(17, handler.nextHandler.startPc.bytecodeOffset); assertEquals(20, handler.nextHandler.endPc.bytecodeOffset); assertEquals(null, handler.nextHandler.nextHandler); }