flexmark-java icon indicating copy to clipboard operation
flexmark-java copied to clipboard

Document.toString()

Open znerd opened this issue 4 years ago • 0 comments

Describe the bug

Currently Document.toString() does not appear to be implemented (properly).

Simple test case:

package com.vladsch.flexmark.util.ast;

import static org.junit.jupiter.api.Assertions.assertNotEquals;

import com.vladsch.flexmark.parser.Parser;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

final class DocumentTest {
  @Nested
  class toString {

    @Test
    void differentObjectsNotEqualString() {
      final Parser parser = Parser.builder().build();
      final Document a = parser.parse("a");
      final Document b = parser.parse("b");
      assertNotEquals(
          a.toString(), b.toString(), "Expected toString() to be different for different objects.");
    }
  }
}

In both cases, Document{} is returned.

A more advanced test can be implemented using the ToStringVerifier library.

Please implement toString on the Document class, and related classes.

znerd avatar May 24 '21 17:05 znerd