ThrawnCA commented on PR #1572:
URL: https://github.com/apache/commons-lang/pull/1572#issuecomment-3768075695
I can see some possible paths to fixing this, but more clarity is needed on
the desired behaviour.
In cases such as `abbreviate("abcdefghijklmno", "...", 6, 10)`, there are
multiple ways that the string could be abbreviated while keeping the contract:
1. We could prioritise retaining as much of the original string as possible,
and truncate it to `"abcdefg..."`
2. We could prioritise making the offset the leftmost character, and
truncate it to `"...ghij..."`
If 1) is preferred, then the existing unit test:
assertAbbreviateWithOffset("...ghij...", 6, 10);
is incorrect. It should instead abbreviate to `"abcdefg..."`
On the other hand, if 2) is preferred, then the existing unit test:
assertAbbreviateWithOffset("abcdefg...", 4, 10);
is incorrect. This case should instead abbreviate to `"...efgh..."`
If either behaviour is acceptable, then the unit tests are too strict.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]