# Can kotlin.test.assertEquals provide a link to diff like org.junit.assertEquals?

**URL:** <https://discuss.kotlinlang.org/t/can-kotlin-test-assertequals-provide-a-link-to-diff-like-org-junit-assertequals/14624>\
**Category:** Support\
**Created:** [October 13, 2019, 12:37am UTC](https://discuss.kotlinlang.org/t/can-kotlin-test-assertequals-provide-a-link-to-diff-like-org-junit-assertequals/14624 "2019-10-13T00:37:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vladimir\_schneider](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/vladimir_schneider/32/1420_2.png) [@vladimir\_schneider](https://discuss.kotlinlang.org/u/vladimir_schneider)\
**Post date:** [October 13, 2019, 12:37am UTC](https://discuss.kotlinlang.org/t/can-kotlin-test-assertequals-provide-a-link-to-diff-like-org-junit-assertequals/14624/1 "2019-10-13T00:37:02Z")

</div>

When running tests in IntelliJ, is there a way to get kotlin.junit.assertEquals to output a `<Click to see difference>` link in the console the same way `org.junit.Assert.assertEquals` does?

It is extremely convenient to see a difference in text, especially for long text without line breaks:

 ![Scrn_JUnit_AssertDiff](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/a/adc67fcc4454a42104a20d37450a1a6da235f4f7.png)

Vs. Kotlin assert console only output:

 ![Scrn_Kotlin_AssertDiff](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/8/82580bb709dbd07ba09a540fa630400d3d01ce38.png)

Or is the right solution to use Kotlin for tests but with JUnit for assertEquals?

---

<div class="post-metadata">

**Author:** ![ilya.gorbunov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/ilya.gorbunov/32/1645_2.png) [@ilya.gorbunov](https://discuss.kotlinlang.org/u/ilya.gorbunov)\
**Post date:** [October 14, 2019, 11:16pm UTC](https://discuss.kotlinlang.org/t/can-kotlin-test-assertequals-provide-a-link-to-diff-like-org-junit-assertequals/14624/2 "2019-10-14T23:16:59Z")

</div>

You can add a dependency on `kotlin-test-junit` or `kotlin-test-junit5` artifact in the jvm sourceSet of your project. Then `assertEquals` will be throwing `org.junit.ComparisonFailure` exception instead of `java.lang.AssertionError` on a failed `assertEquals` check, and IDEA will be able to extract from that the expected and actual values.

---

<div class="post-metadata">

**Author:** ![vladimir\_schneider](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/vladimir_schneider/32/1420_2.png) [@vladimir\_schneider](https://discuss.kotlinlang.org/u/vladimir_schneider)\
**Post date:** [October 15, 2019, 1:53am UTC](https://discuss.kotlinlang.org/t/can-kotlin-test-assertequals-provide-a-link-to-diff-like-org-junit-assertequals/14624/3 "2019-10-15T01:53:06Z")

</div>

Thank you Ilya.
