Pleasant surprise on JUnit.assertEquals() integration

Just stumbled upon a part of IDEA's JUnit integration if you have a failure of assertEquals(String, String). When a string is multi-line, the failure actually integrates with the differ via ]]> from the run panel to show you how those Strings are different. Very sweet. When did that get added? I'm using 3354.

Jon

7 comments
Comment actions Permalink

In article <116078.1118686328191.JavaMail.itn@is.intellij.net>,
Jon Steelman <no_mail@jetbrains.com> wrote:

Just stumbled upon a part of IDEA's JUnit integration if you have a failure
of assertEquals(String, String). When a string is multi-line, the failure
actually integrates with the differ via <Click to see difference> from the
run panel to show you how those Strings are different. Very sweet. When did
that get added? I'm using 3354.


Huh? Can you clarify? :)

Thanks
R

0
Comment actions Permalink

assertEquals("line1\nline2", "line1\nline2\nline3"); will fail, in the output you will find a link that pops up a diff window.

This feature was introduced somewhere in the region of build number 900

0
Comment actions Permalink

Exactly. Maas, why did you wait so long to tell us? ;)

0
Comment actions Permalink

In article <6039121.1118688688928.JavaMail.itn@is.intellij.net>,
Maas van den Berg <no_mail@jetbrains.com> wrote:

assertEquals("line1\nline2", "line1\nline2\nline3"); will fail, in the output
you will find a link that pops up a diff window.

This feature was introduced somewhere in the region of build number 900


OH yeah, sorry didn't quite get Jon's explanation. That's been there as
you mention.

R

0
Comment actions Permalink

That was already in 4.5.

0
Comment actions Permalink

Oops, sorry somehow Thunderbird did not show the other replies.

Really nice feature indeed. I have a test that compares two xml files and I refactored it, so that it uses assertEquals() just to get Idea's diff if it fails.

0
Comment actions Permalink

That's how I actually stumbled across it, comparing xml output. The feature is great for that.

0

Please sign in to leave a comment.