IntelliJ outputs error messages twice
See original GitHub issueI am working on IntelliJ 2019.3, with Truth 1.0 and Java 11.0.6, and running tests using Junit 5.6.0.
I’m trying to do test some basic assertions, such as checking the value of an int. However, IntelliJ is printing the messages twice:
@Test
@Tag("D")
public void testDuplicateDemo() {
    int x = 5;
    assertThat(x).isEqualTo(10);
}
Outputs:

This is rather annoying and unexpected behavior. If I test equality of Strings, the same behavior is shown, unless the string has multiple lines, in which case, only expected / but was appears.
Why is this happening? Is there a workaround / fix? Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (7 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
IntelliJ duplicates certain assertion failures : IDEA-238472
The custom error message from the assertion library is logged, ... For Strings, AssertJ, JUnit, and Truth output twice (JUnit does it slightly...
Read more >SoftAssert shows error messages twice - java - Stack Overflow
I'm running tests with Intellij IDEA using TestNG as a testing framework. If some soft asserts are failing, then I get duplicated error...
Read more >Top 6 Ways To Fix Illegal Start Of Expression Error In Java
prinln("Result = " + output); 22. } String values must be always enclosed in double quotation marks to avoid the error similar to...
Read more >How to Handle the Incompatible Types Error in Java - Rollbar
This might seem like a syntax error, but it is a logical error discovered in the semantic phase of compilation. The error message...
Read more >5 tips for using Gradle with IntelliJ IDEA 2019 - Tom Gregory
If you have a more complex build that relies on running tasks in addition to standard compilation, this may not working when using...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

There may be drawbacks to this that I’m not thinking of, but…
I would love to see this changed on the IntelliJ side. If the
ComparisonFailureorAssertionFailedErrorhas a message, I would like to see IntelliJ skip displaying its own “Expected” and “Actual” (though keep its “<Click to see difference>”).In the case of the “standard JUnit message format,” I wouldn’t mind if IntelliJ instead skipped displaying the message in favor of displaying only “Expected” + “Actual” + “<Click to see difference>.” This doesn’t matter to Truth, but it matters to AssertJ under JUnit 4 and to JUnit’s own assertions (4 and 5 both, IIUC).
https://youtrack.jetbrains.com/issue/IDEA-238472