commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject [2/3] [lang] Clean up if in CharUtilsTest#testIsAscii_char
Date Sun, 01 Oct 2017 12:33:47 GMT
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.


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/c7554151
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/c7554151
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/c7554151

Branch: refs/heads/master
Commit: c7554151d3f695718a5bd431e22c7f4c39a0b261
Parents: 7076b74
Author: Allon Mureinik <amureini@redhat.com>
Authored: Sat Sep 30 15:25:34 2017 +0300
Committer: pascalschumacher <pascalschumacher@gmx.net>
Committed: Sun Oct 1 14:33:16 2017 +0200

----------------------------------------------------------------------
 src/test/java/org/apache/commons/lang3/CharUtilsTest.java | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/c7554151/src/test/java/org/apache/commons/lang3/CharUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharUtilsTest.java
index bd92c33..35f7f02 100644
--- a/src/test/java/org/apache/commons/lang3/CharUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharUtilsTest.java
@@ -220,11 +220,7 @@ public class CharUtilsTest {
         assertFalse(CharUtils.isAscii(CHAR_COPY));
 
         for (int i = 0; i < 128; i++) {
-            if (i < 128) {
-                assertTrue(CharUtils.isAscii((char) i));
-            } else {
-                assertFalse(CharUtils.isAscii((char) i));
-            }
+            assertEquals(i < 128, CharUtils.isAscii((char) i));
         }
     }
 


Mime
View raw message