-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing Click to see difference support in IntelliJ #254
Comments
Hmm, that definitely was working at some point. I'll investigate. |
+1 this. I am used to Ctrl+D on failing tests to bring up the diff view. It is extremely useful and works with AssertJ. It does't work with Strikt. |
I think it has something to do with incorrect configuration of |
Ok, it seems that IntelliJ expects exactly this to be at the end of the AssertionFailedError.message:
Prefixes before Adding descriptions at front will work
as long as
Also this will work:
|
In my opinion, this issue is related to #257 and both issues should be addressed at the same time. JUnit first logs the Perhaps adding
where
is AssertionFailed.message. @robfletcher what do you think about this idea? |
@yuriykulikov This sounds great - also really missing intellij integration. Is there anyway to get this behaviour somehow without it being implemented in Strikt (eg extension functions, duplicating some part of the Strikt codebase locally or something?) |
Hello, @robd I am using this function:
Does the trick for me 😺 |
In the end I patched this with a somewhat convoluted workaround. I didn't want to have to change all of my assertions or remember to use a non standard assertion, so I implemented an approach based on intercepting strikts
class IntellijFix : TestExecutionExceptionHandler {
override fun handleTestExecutionException(context: ExtensionContext, throwable Throwable) {
when(throwable) {
is AssertionFailed -> throw assertionEqualsFailure(throwable) ?: throwable
else -> throw throwable
}
}
private fun assertionEqualsFailure(striktFailure: AssertionFailed) = try {
assertEquals(striktFailure.expected?.value, striktFailure.actual?.value, striktFailure.message)
null
} catch (assertEqualsFailure: AssertionFailedError) { assertEqualsFailure }
}
|
With other assertion Frameworks the logmessage of a failure gets an link to a diff.
This is very useful especially with comparing large Json.
I don't get it with strikt. I'd like to have another logmessage, which enables the IntelliJ-Click-to-see-difference-Feature or an IntelliJ-Strikt-Plugin wich does something similar.
The text was updated successfully, but these errors were encountered: