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
Add bytes()
/bytes(Charset)
/bytes(String)
navigation methods to AbstractStringAssert
#3229
Comments
What if we would stay closer to Following the style of other navigation methods, we could add String actual = "";
assertThat(actual)
.hasSize(0)
.bytes(StandardCharset.US_ASCII) // AbstractByteArrayAssert
.hasSize(0) I would also consider the variant without parameters and the one with |
@scordio The |
bytes(Charset)
navigation method to AbstractStringAssert
bytes(Charset)
navigation method to AbstractStringAssert
bytes()
/bytes(Charset)
/bytes(String)
navigation methods to AbstractStringAssert
@scordio I was looking into this one as it seems like a good starting point for me to contribute. I've noticed that there are already methods such as Lastly, what do you think the expected behavior should be in case of a null (actual) String? Should It throw an exception right away? or return a ByteArrayAssert with a null actual value? There are a few examples in the PR link assertThat((String) null).asBytes() // throws error right away?
// or allows
assertThat((String) null).asBytes().isNull() |
Thanks for your interest, @etrandafir93!
To the best of my knowledge, there is no We tend to favor the For this reason, I would go with
It doesn't make much sense to execute navigation methods when the object under test is null, therefore I suggest performing an |
Right, I was mistakenly looking at the released version instead of the latest codebase, sorry 🙂 |
Hello @scordio, @joel-costigliola, I've opened the #3232 some time ago. I'd appreciate your feedback here whenever you have a moment - your time and expertise in reviewing this would mean a lot. Let me know if there's anything I can do to assist in the process. Thanks, and I'm looking forward to your response. |
Hi @etrandafir93 , thanks a lot and apologies for the delay. We're currently finalizing 3.25.0 and we'll need some time before we can jump on your PR. As we want to freeze the release scope, I'll schedule your changes for 3.26.0. |
@scordio no worries - thanks for reaching out and explaining the process! |
Feature summary
Add
AbstractStirngAssert#extracting(Charset)AbstractByteArrayAssert
so that thebyte[]
can be verified.Example
The text was updated successfully, but these errors were encountered: