Replies: 9 comments
-
Open to suggestions, would be worth seeing how other assertion libs handle this. |
Beta Was this translation helpful? Give feedback.
-
In IntelliJ it makes things difficult because it doesn't work nicely with the inbuilt assertion diff feature. |
Beta Was this translation helpful? Give feedback.
-
Hm, I'd rather not introduce a configuration for this. However I do think there's room for improvement with the error message. A couple of ideas would be to 1: move the diff to it's own lines so that the original contents are included and it's easier to scan, and 2: change the diff symbol so something that's less likely to be used in the contents. Something like:
Downside of this is intellij's assertion diff feature is extremely picky and won't show in this case. It does show if the additional diff is above instead of below, but I don't think that reads very well. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
There is a related issue in opentest4j. I guess diff should eventually be solved there. If it's solved at the opentest4j level then it'll eventually make it in to JUnit5, which in turn will be eventually be supported by all the major IDEs. |
Beta Was this translation helpful? Give feedback.
-
Hello all, Sorry about vanishing, but some mails are going to my gmail social folder. I need to update those filters. @evant Might I ask why don't you want to introduce another configuration? @BrynCooke Even if it is fixed on opentest4j, the core issue will still be present, since the assertion text will introduce extra characters. |
Beta Was this translation helpful? Give feedback.
-
The reason I don't want to introduce a configuration is that I don't think it adequately solves the problem. The way I see it, there's two issues here:
Also, not aware of any other assertion lib out there that lets you configure this. |
Beta Was this translation helpful? Give feedback.
-
I don't think there is a good answer at the moment. This requires some sort of fix outside of the assertk codebase. So probably just leave things as they are for now. |
Beta Was this translation helpful? Give feedback.
-
This is not a critical issue because it should not happen that often. Although I think that compatibility with Intellij should be an afterthought. After all, most of the time I look at those messages is through a command line. Feel free to close the issue if you think it should be addressed at another level. |
Beta Was this translation helpful? Give feedback.
-
These "[]" really bother me. I think it is the job of the IDE to highlight the differences. Which works really well with JUnit and IntelliJ IDEA. Therefore I prefer to keep the expected/actual value as they are. |
Beta Was this translation helpful? Give feedback.
-
On expectation fail, the library issues a message displaying what went wrong.
If the expectation is a String object it will wrap the differences in angle brackets
[ ]
. This is a cool feature that highlights where the problem is but changes the content of the expectation and the actual value.The issue is worse if the values already contain angle brackets by themselves, making it harder to spot where the problem is. Bellow is the output of a failing test.
I've checked the custom fail messages, but it seems a different use case.
It would be nice to allow disabling this highlight feature.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions