Skip to content
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

Boolean's shouldBeTrue/shouldBeFalse extension showing incorrect error message #89

Closed
criverad opened this issue Jan 10, 2018 · 4 comments

Comments

@criverad
Copy link

Hi all,

Running something like:

true.shouldBeFalse()

prints the following exception to the console:

null
java.lang.AssertionError
	at org.junit.Assert.fail(Assert.java:86)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at org.junit.Assert.assertFalse(Assert.java:64)
	at org.junit.Assert.assertFalse(Assert.java:74)
	at org.amshove.kluent.BasicKt.shouldBeFalse(Basic.kt:28)
...

the error message is misleading (null) and it could be improved to something more descriptive.

@AndreasVolkmann
Copy link
Collaborator

Totally agree. Error messages are something that needs to be worked on.

@MarkusAmshove
Copy link
Owner

I agree that messages should be clearer. I thought delegating to the JUnit assertions was fine enough, but they don't seem to provide good messages all times.

I've written a prototype to get the behavior of Shoudly where if you write

val number = 5
number.shouldEqual(10)

you get the exact statement (number.shouldEqual(10)) in the failure message, but getting the source from the compiled class files isn't that reliable :-/
In .NET they seem to just have the path to the source in the PDB (debug) files.

@MarkusAmshove
Copy link
Owner

If you want you can review the change before I release it :-)

@MarkusAmshove
Copy link
Owner

I've just released these changes with v1.34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants