void printInfo(Line badLine, String msg) {
    Line line = getFirstLine();
    PrintStream stream = System.out;

    int i = 0;
    while (line != null) {

      int indent = line.getIndent();

      stream.println(
          CollectionUtils.repeat('.', line.getIndent())
              + line.toString()
              + " indent:"
              + indent
              + CollectionUtils.repeat(' ', 20)
              + line.getCachedNumberValue()
              + "  ("
              + i
              + ")");

      if (line == badLine) {
        stream.println("\n\n\n");
        stream = System.err;
        stream.println(msg);
        stream.println(">>>>>>>>>>>>>>>>>>>>>>>>> DIED ON LINE ABOVE <<<<<<<<<<<<<<<<<<\n\n");
      }

      line = line.next();
      i++;
    }
  }
  /**
   * Check the current line numbering is consistent with the document state.
   *
   * @param iter current test iteration, for debugging/logging purposes.
   */
  void check(int iter) {

    runTask();

    //    if (iter >= 1740) {
    //      info("\n\nCHECKING\n");
    //      printInfo(null, "XX");
    //      info("---");
    //    }

    LevelNumbers numbers = new LevelNumbers(0, 1);
    Line line = getFirstLine();

    while (line != null) {

      int indent = line.getIndent();

      numbers.setLevel(indent);
      if (line.isDecimalListItem()) {
        int num = numbers.getNumberAndIncrement();
        assertFalse(line.getCachedNumberValue() == Line.DIRTY);
        if (num != line.getCachedNumberValue()) {
          String msg = "Expected: " + num + ", got: " + line.getCachedNumberValue();
          printInfo(line, msg);
          fail(
              "Wrong number on iteration "
                  + iter
                  + ". "
                  + msg
                  + ". See stdout & stderr for debug details");
        }
      } else {
        numbers.setNumber(1);
      }

      line = line.next();
    }

    //    info("^^^");
  }