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
Bytes assertions enhancements - better readability #148
Comments
Awesome stuff. I'm in favor. |
…or better readability
…or better readability
I was a little skeptic because we change a standard representation but since more than one user likes it and we know that we are asserting bytes then I'm ok to integrate it. I'll review the PR by the end of the year. Thanks for the idea and the contribution. |
Im little skeptic too :) We can do this better. My proposition is to use something like Representation - StandardRepresentation for printing standard values like Standard representation:-
Result:
Hexadecimal representation:
Result:
Binary representation:
Result:
This apply to all form of assertions, if it makes sense. |
This also is more clear, we can add special information like Expecting in hexadecimal representation:.
Other examples
|
…ion of objects
…or better readability
…ion of objects
I think we should concentrate on bytes enhancements first and create another issue with the more global "presentation" stuff. I need to take more time to think about the latter, I like the idea but I'm worried it may be too much, I don't see a need for that but it does not mean there is not, it would be good to have some real life examples. Things are getting a little messy on git, I have fetched your assertj fork repository and see two similar commits for "compact message for better readability": mariuszs@8abb54d on topic/presentation branch and mariuszs@a782c71 on topic/compact_hex_view. I see also two PR, one coming from topic/presentation and another from topic/compact_hex_view, the first including the latter. The topic/compact_hex_view PR is good, I have two comments on it:
|
I think "presentation stuff" is helpful and fix some issues. For example natural for byte is format like I can prepare more useful scenerios. Btw, presentation stuff PR is not complete yet. it needs more love, refactor, name change and javadocs :) but in general works :) Other interesting example is comparing UNICODE characters - many unicode chars have duplicate characters assigned, so this is impossible to find differences from standard message:
Standard message:
Hexadecimal message with
I think this is useful only in "presentation stuff" |
…ion of objects
…ion of objects
…or better readability
Messy on git fixed :) |
…or better readability
Ok I'm convinced this is useful :) Tell me when you think the PR can be reviewed. |
I think this is ready for review. General change in this PR is to replace static invocation to In In There is many JavaDocs missing or incomplete, I need help with this. I dont have time also to make bigger refatoring, please look if refactoring is needed now. Also |
Yes, I think we can find a better naming for Presentation concept, Representation is not bad, Renderer is too GUI oriented to me, anyway I will also take some time to think to this. For the javadoc, just focus on the API part, the one that is used by users, the remaining is less important. Thanks for the work ! |
…ion of objects
I think its ready, of course there is place for improvments... Please make review. Colon notation in hex is removed, we can add this later. |
I haven't done a full review yet this will take some time but I have got already some comments:
my most important comment last !
assertThat(theTwoTowers.getReleaseDate()).asBinary().isInThePast(); |
In general, you most important comment is right but hard to implement properly. If we enable this api for collections and arrays, then this involve all object types. So I will prefer to make this for general use and eventually add more implementations types (ex. for BigInteger, other object via ObjectOutputStream etc) or simply print |
Eventually we can add more detailed information in JavaDoc, somehting like: |
One solution would be to change |
Your comments included, any progress with review? |
No real progress :( but definitely on my short time todo list ! |
real progress :) Anyway, thanks for this big contribution and being patient ! |
Damned ! I think I missed your latest commits (not sure why), I have to merge them on top of what I did and it has some overlapping ... :( |
Just a thought, I'm wondering if we should rename We are planning to add XML assertions like this : // assertThat(xmlString).asXml() converting the String to an XML Document and returns an XmlAssert instance,
assertThat(xmlString).asXml().containsXpath("//planet[@name='Earth']"); and writing With an example: assertThat("µµµ").inHexadecimal().contains("μμμ"); Any objections ? |
No, 👍 for |
We should integrate JsonPath assertion and add |
Interesting ! We have already some plan to add JSON assertions, I'm adding a reference to JsonPath in #75 |
@mariuszs I don't have the compact hexa notation when executing assertThat("zólc".getBytes()).asHexadecimal().contains("żółć".getBytes("ISO-8859-2")); This is strange because I have integrated your work, as I had trouble with git and your branches, I have probably missed a commit. I'm a little bit lost right here ... |
Ok, I'm looking into it 2014-01-30 Joel Costigliola notifications@github.com:
Mariusz Smykuła |
thanks for looking into it ! |
Hmm, this works for me just fine :)
|
Ok, I dont see any problems (after first look) , all is working. We have even test for this assertions
Please rebuild assertj from master again :) |
Bumps [mockito-bom](https://github.com/mockito/mockito) from 4.5.0 to 4.5.1. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](mockito/mockito@v4.5.0...v4.5.1) --- updated-dependencies: - dependency-name: org.mockito:mockito-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
My proposition for assertions arrays:
This is more readable than:
Simple values comparision without changes:
What do you think?
The text was updated successfully, but these errors were encountered: