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

Consider using a more descriptive message in AbstractHamcrestCondition #21

Closed
johanhaleby opened this issue Jul 20, 2015 · 5 comments
Closed

Comments

@johanhaleby
Copy link
Collaborator

What steps will reproduce the problem?
1. Write an assertion that checks objects/list of objects which do not have a 
toString() method implemented
2. Have the assertion condition fail with a timeout

What is the expected output? What do you see instead?
The original mismatch description is not preserved in the message of the 
ConditionTimeoutException, the second part of the message ("but was ...") just 
contains the return value of toString() 

What version of the product are you using? On what operating system?
awaitility 1.6.3 on Ubuntu 14.04 LTS x64, Java 1.8.0_40

Please provide any additional information below.

The code to display a more descriptive message is actually present in the code 
but commented out:
https://github.com/jayway/awaitility/blob/4e9a036ef9bada9cba9219875e0be5e8fc4c83
98/awaitility/src/main/java/com/jayway/awaitility/core/AbstractHamcrestCondition
.java#L63-L64

The reason we do not have toString() on our objects is that in most cases it 
would output a lengthy list of parameters that would just flood the console and 
make everything unreadable.

Judging by the code there is no way for me to enable more descriptive messages. 
Could you please consider changing the message to include more descriptive 
messages or include an option for enabling them?

Original issue reported on code.google.com by socketb...@gmail.com on 18 Mar 2015 at 11:00

@johanhaleby
Copy link
Collaborator Author

Original comment by johan.ha...@gmail.com on 1 Apr 2015 at 9:19

  • Changed state: Accepted
  • Added labels: Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

@johanhaleby
Copy link
Collaborator Author

Using Matcher.describeMismatch() method is the standard way to extend Hamcrest 
error messages. Could you please consider making this feature request higher 
than Low prio? (BTW, thx for a great library!)

Original comment by patrik.h...@gmail.com on 9 Jun 2015 at 9:17

@petetronic
Copy link

+1

2 similar comments
@AlexeyBuzdin
Copy link

+1

@iodb
Copy link

iodb commented Oct 20, 2016

+1

chanceVermilion pushed a commit to chanceVermilion/awaitility that referenced this issue Feb 17, 2017
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

4 participants