### Question:
Line { public Line segment(int offset, int length) { return new Line(lineNumber, this.offset + offset, text.substring(offset, offset + length)); } Line(int lineNumber, int offset, String text); boolean isEmpty(); String getText(); int getOffset(); int getLineNumber(); Line segment(int offset, int length); Locator toLocator(); @Override String toString();  }### Answer:
@Test public void segment() { Line segment = new Line(2, 15, "0123456789").segment(3, 5); assertNotNull(segment); assertEquals(2, segment.getLineNumber()); assertEquals(15 + 3, segment.getOffset()); assertEquals("34567", segment.getText()); }