GitHub user mureinik opened a pull request: https://github.com/apache/commons-lang/pull/293
Char utils test Several enhancements to `CharUtilsTest` to make the test more robust and cover more functionality. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-lang CharUtilsTest Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/293.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #293 ---- commit c00920fe55dc61504bc0de2a8df004fc7264f5bf Author: Allon Mureinik <amure...@redhat.com> Date: 2017-09-30T12:25:34Z Clean up if in CharUtilsTest#testIsAscii_char The if statement calls assertTrue on the if branch and assertFalse on the else branch on the same expression. This can easily be simplified to assertEquals with a boolean expression to make the code clean and easier to read. commit 9512d67084b340c7493ff89f2f2cd2e4eee33241 Author: Allon Mureinik <amure...@redhat.com> Date: 2017-09-30T12:27:42Z CharUtilsTest#testIsAscii_char loop The loop currently loops only up to 128, thus testing just positive return values of CharUtils#isAscii(char). This patch increase the loop to go over all the possible values of an unsigned byte, thus testing also negative return values. commit b763decb69826b0fd4387e53dfd9c4ca5ab91467 Author: Allon Mureinik <amure...@redhat.com> Date: 2017-09-30T12:32:54Z Improve tests for CharUtils illegal usages CharUtilsTest has several instances of the following pattern: try { CharUtils.someMethod("illegal input"); } catch (final IllegalArgumentException ex) {} This pattern is not very useful for testing, as the test would pass whether an IllegalArgumentException is thrown or not. This patch enhances the test by explicitly failing it if the exception is not thrown: try { CharUtils.someMethod("illegal input"); fail("An IllegalArgumentException should have been thrown"); } catch (final IllegalArgumentException ex) {} ---- ---