* Consolidate the StringUtils.equals and equalsIgnoreCase methods.
Implement the same edge case logic for null. Use the same parameter
names. Use the same Javadoc wording. Change the equals method to use a
step-wise charAt comparison.
* LANG-1436: Added Jira to changes.xml.
Use JUnit methods to clean up the test and simplify the assertions:
- assertArraysEqual(x, y) replaces assertTrue(Arrays.equals(x, y))
- assertEquals(x, y) replaces assertTrue(x == y)
- assertNotEquals(x, y) replaces assertFalse(x == y)
JUnit Jupiter 5.4.0 supports deltas of 0 when asserting double and
float equalities.
This patch utilizes these new assertEquals methods and removes the
hack of using assertTrue with an == statement that was needed in older
JUnit versions.
Use built-in assertion methods provides by
org.junit.jupiter.api.Assertions instead of reimplementing the same
logic with assertTrue and assertFalse.
Note that JUnit Jupiter 5.3.1 does not support deltas of 0 for
assertEquals(double, double, double) and
assertEquals(float, float, float), so these usages of assertTrue were
left untouched, and will be addressed when JUnit Jupiter 5.4, that
addresses this isssue, will be available (see
https://github.com/junit-team/junit5/pull/1613 for details).
Now that the entire project is ported to JUnit Jupiter, there are more
elegant ways to test for exceptions, which this patch applies
throughtout the code base.
If throwing an exception is supposed to fail a test, just throwing it
outside of the method cleans up the code and makes it more elegant,
instead of catching it and calling Assertions#fail.
If an exception is supposed to be thrown, calling
Assertions#assertThrows is a more elegant option than calling
Assertions#fail in the try block and then catching and ignoring the
expected exception.
Note that assertThrows uses a lambda block, so the variables inside it
should be final or effectively final. Reusing variables is a common
practice in the tests, so where needed new final variables were
introduced, or the variables used were inlined.
This patch converts testParseAllLocales to a @ParameterizedTest instead
of iterating over the locales inside the method's body.
This changes allows using standard asserts for each case individually
instead of having to count failures and print the problematic locales
to System.out.