### Question:
Line { public Locator toLocator() { return new SimpleLocator(this); } 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 toLocator() { Line line = new Line(2, 15, "0123456789"); Locator locator = line.toLocator(); assertNotNull(locator); assertEquals(3, locator.getLineNumber()); assertEquals(15, locator.getLineDocumentOffset()); }