Class CommentAssertionError

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    DiffHelper.DiffAssertionError

    public class CommentAssertionError
    extends AssertionError
    An instance of this class can be used to fail a JUnit test together with some formatted comments instead of a simple plain text message. The JUnit module runner will catch the comments and output them as an error message.
    See Also:
    Serialized Form
    • Constructor Detail

      • CommentAssertionError

        public CommentAssertionError()
        Initialize with an empty list of comments
      • CommentAssertionError

        public CommentAssertionError​(Throwable cause)
        Initialize with an empty list of comments
        Parameters:
        cause - causing exception
      • CommentAssertionError

        public CommentAssertionError​(Content singleComment)
        Initialize with a first comment
        Parameters:
        singleComment - a first comment
      • CommentAssertionError

        public CommentAssertionError​(Content singleComment,
                                     Throwable cause)
        Initialize with a first comment
        Parameters:
        singleComment - a first comment
        cause - causing exception
      • CommentAssertionError

        public CommentAssertionError​(Content firstComment,
                                     Content secondComment)
        Initialize with two initial comments, that can be extended by calling #addComment(Comment).
        Parameters:
        firstComment - a first comment
        secondComment - a second comment
      • CommentAssertionError

        public CommentAssertionError​(Content firstComment,
                                     Content secondComment,
                                     Throwable cause)
        Initialize with two initial comments, that can be extended by calling #addComment(Comment).
        Parameters:
        firstComment - a first comment
        secondComment - a second comment
        cause - causing exception
      • CommentAssertionError

        public CommentAssertionError​(Collection<Content> comments)
        Initialize with a first set of comments
        Parameters:
        comments - a first set of comments
      • CommentAssertionError

        public CommentAssertionError​(Collection<Content> comments,
                                     Throwable cause)
        Initialize with a first set of comments
        Parameters:
        comments - a first set of comments
        cause - causing exception
    • Method Detail

      • addComment

        public void addComment​(Content comment)
        Adds a comment
        Parameters:
        comment - a new comment
      • prependComment

        public void prependComment​(Content comment)
        Adds a comment to the top of the list
        Parameters:
        comment - a new comment
      • getComments

        public List<Content> getComments()
        Returns:
        unmodifiable view of comments
      • setTestScore

        public void setTestScore​(Double s)
      • getTestScore

        public Double getTestScore()