Open
Description
This is a follow-up on #138 where we used new AssertionFailedError(message, expected, actual)
to pass expected
and actual
for assertEquals
, assertSame
, and assertNull
.
However, we should consider passing unexpected
and actual
for
Assertions.assertNotEquals
Assertions.assertNotSame
(hmm...unexpected == actual
in this case)Assertions.assertNotNull
(justactual
?)
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
jbduncan commentedon Oct 23, 2016
FYI, Google Truth produces IMO rather nice error messages that show how
actual
andexpected
differ to each other if they are both strings. Perhaps their error message format could be a source of inspiration for this issue.10 remaining items
stale commentedon May 13, 2021
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. Thank you for your contribution.
jbduncan commentedon May 13, 2021
Google Truth, AssertJ and Kotest's assertions could still be useful sources of inspiration here?
stale commentedon Jun 21, 2022
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. Thank you for your contribution.
jbduncan commentedon Jul 1, 2022
This still seems somewhat useful to me.
MalformedParametersException
on JDK 8 for synthetic bridge methods in Jupiter classes (5.11.0-M1) #3797AssertionFailedError
with negation context support ota4j-team/opentest4j#157YongGoose commentedon Apr 20, 2025
@marcphilipp
Hope you're enjoying a restful Easter break. 🎉
Just dropping by as I had an idea related to this issue and wanted to share it.
Modifying the reason field could be a good solution as well, but in that issue, I proposed adding explicit support for negation context in
AssertionFailedError
—such as introducing aboolean flag
. (for clearer field semanticsexpected
becomes context-aware)AssertionFailedError
with negation context support ota4j-team/opentest4j#157I believe this approach could offer a cleaner and more semantically accurate way to report failures in negative assertions like
assertNotEquals
,assertNotSame
, andassertNotNull
, while preserving backward compatibility.WDYT?
YongGoose commentedon Apr 20, 2025
#282 (comment)
I believe this approach would consume more resources than modifying the reason, as it would require updating the changes in the
IDE
andother frameworks
as well. However, from the user's perspective, the user experience would improve as they would receive a similarterminal interface
(compare withassertEquals
).If the team determines that modifying the
reason
is more suitable than the approach I have in mind, I will come up with a solution to modify the reason accordingly. 🙂AutoCloseable
in Jupiter's ExtensionContext.Store #4452