question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IntelliJ outputs error messages twice

See original GitHub issue

I 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:

Annotation 2020-04-19 010740

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:open
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
cpovirkcommented, Apr 21, 2020

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 ComparisonFailure or AssertionFailedError has 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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found