Package de.hsh.graja.modules.junit.api
Class CommentAssertionError
java.lang.Object
java.lang.Throwable
java.lang.Error
java.lang.AssertionError
de.hsh.graja.modules.junit.api.PositionAssertionError
de.hsh.graja.modules.junit.api.CommentAssertionError
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DiffHelper.DiffAssertionError
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:
-
Constructor Summary
ConstructorsConstructorDescriptionInitialize with an empty list of commentsCommentAssertionError
(Content singleComment) Initialize with a first commentCommentAssertionError
(Content firstComment, Content secondComment) Initialize with two initial comments, that can be extended by callingaddComment(Comment)
.CommentAssertionError
(Content firstComment, Content secondComment, Throwable cause) Initialize with two initial comments, that can be extended by callingaddComment(Comment)
.CommentAssertionError
(Content singleComment, Throwable cause) Initialize with a first commentCommentAssertionError
(Throwable cause) Initialize with an empty list of commentsCommentAssertionError
(Collection<Content> comments) Initialize with a first set of commentsCommentAssertionError
(Collection<Content> comments, Throwable cause) Initialize with a first set of comments -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComment
(Content comment) Adds a commentvoid
prependComment
(Content comment) Adds a comment to the top of the listvoid
Methods inherited from class de.hsh.graja.modules.junit.api.PositionAssertionError
getPos, setPos
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CommentAssertionError
public CommentAssertionError()Initialize with an empty list of comments -
CommentAssertionError
Initialize with an empty list of comments- Parameters:
cause
- causing exception
-
CommentAssertionError
Initialize with a first comment- Parameters:
singleComment
- a first comment
-
CommentAssertionError
Initialize with a first comment- Parameters:
singleComment
- a first commentcause
- causing exception
-
CommentAssertionError
Initialize with two initial comments, that can be extended by callingaddComment(Comment)
.- Parameters:
firstComment
- a first commentsecondComment
- a second comment
-
CommentAssertionError
Initialize with two initial comments, that can be extended by callingaddComment(Comment)
.- Parameters:
firstComment
- a first commentsecondComment
- a second commentcause
- causing exception
-
CommentAssertionError
Initialize with a first set of comments- Parameters:
comments
- a first set of comments
-
CommentAssertionError
Initialize with a first set of comments- Parameters:
comments
- a first set of commentscause
- causing exception
-
-
Method Details
-
addComment
Adds a comment- Parameters:
comment
- a new comment
-
prependComment
Adds a comment to the top of the list- Parameters:
comment
- a new comment
-
withPos
- Overrides:
withPos
in classPositionAssertionError
-
getComments
- Returns:
- unmodifiable view of comments
-
setTestScore
-
getTestScore
-