[LANG-1426] Corrected usage examples in Javadocs#458
[LANG-1426] Corrected usage examples in Javadocs#458garydgregory merged 2 commits intoapache:masterfrom mikkomaunu:LANG-1426-StringUtils-truncate-Javadoc
Conversation
|
Why not also properly document legal inputs with |
Makes perfectly sense. Which approach is preferred: One throws per Exception type:
or: |
|
Related theme, should one also fix tests that assert exceptions? Currently message does not describe too well why test failed, instead it often simply repeats Exception message. Also that does not alway match. For example. Following assertion uses "maxWith cannot be negative" as message. That does not describe why test failed. Also, because first argument is validated first, actual message in exception is "offset cannot be negative" I see two approaches to fix this:
When exception is thrown because maxWidth is negative, then there is misspelling: "maxWith cannot be negative"; |
|
WRT |
There was a problem hiding this comment.
Thanks for fixing these! Looks good to me, and agree on the improvement suggested by @garydgregory
|
I we should do what makes the code easier to understand from the perspective of maintenance: If a new person looks at the test, what is best for them to understand what is being tested. What would make it easier to add another test. And so on. |
…ate and consistently mimicking exception message in assertion message
|
I think @mikkomaunu has updated the PR with your suggestions @garydgregory . Should be good to be reviewed now 🎉 |
Fixed documentation. No tests added because existings unit tests seam to cover these code examples reasonably well.