This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new a3e5a01  Sort members.
a3e5a01 is described below

commit a3e5a0134e06911b9ea35b1bcdeefd10a523743f
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Sep 28 15:19:12 2020 -0400

    Sort members.
---
 .../org/apache/commons/lang3/BooleanUtilsTest.java | 1008 ++++++++++----------
 1 file changed, 493 insertions(+), 515 deletions(-)

diff --git a/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java
index a70272f..8920e85 100644
--- a/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/BooleanUtilsTest.java
@@ -34,31 +34,18 @@ import org.junit.jupiter.api.Test;
  */
 public class BooleanUtilsTest {
 
-    //-----------------------------------------------------------------------
     @Test
-    public void testConstructor() {
-        assertNotNull(new BooleanUtils());
-        final Constructor<?>[] cons = 
BooleanUtils.class.getDeclaredConstructors();
-        assertEquals(1, cons.length);
-        assertTrue(Modifier.isPublic(cons[0].getModifiers()));
-        assertTrue(Modifier.isPublic(BooleanUtils.class.getModifiers()));
-        assertFalse(Modifier.isFinal(BooleanUtils.class.getModifiers()));
-    }
-
-    //-----------------------------------------------------------------------
-    @Test
-    public void test_negate_Boolean() {
-        assertSame(null, BooleanUtils.negate(null));
-        assertSame(Boolean.TRUE, BooleanUtils.negate(Boolean.FALSE));
-        assertSame(Boolean.FALSE, BooleanUtils.negate(Boolean.TRUE));
+    public void test_isFalse_Boolean() {
+        assertFalse(BooleanUtils.isFalse(Boolean.TRUE));
+        assertTrue(BooleanUtils.isFalse(Boolean.FALSE));
+        assertFalse(BooleanUtils.isFalse(null));
     }
 
-    //-----------------------------------------------------------------------
     @Test
-    public void test_isTrue_Boolean() {
-        assertTrue(BooleanUtils.isTrue(Boolean.TRUE));
-        assertFalse(BooleanUtils.isTrue(Boolean.FALSE));
-        assertFalse(BooleanUtils.isTrue(null));
+    public void test_isNotFalse_Boolean() {
+        assertTrue(BooleanUtils.isNotFalse(Boolean.TRUE));
+        assertFalse(BooleanUtils.isNotFalse(Boolean.FALSE));
+        assertTrue(BooleanUtils.isNotFalse(null));
     }
 
     @Test
@@ -68,22 +55,20 @@ public class BooleanUtilsTest {
         assertTrue(BooleanUtils.isNotTrue(null));
     }
 
-    //-----------------------------------------------------------------------
     @Test
-    public void test_isFalse_Boolean() {
-        assertFalse(BooleanUtils.isFalse(Boolean.TRUE));
-        assertTrue(BooleanUtils.isFalse(Boolean.FALSE));
-        assertFalse(BooleanUtils.isFalse(null));
+    public void test_isTrue_Boolean() {
+        assertTrue(BooleanUtils.isTrue(Boolean.TRUE));
+        assertFalse(BooleanUtils.isTrue(Boolean.FALSE));
+        assertFalse(BooleanUtils.isTrue(null));
     }
 
     @Test
-    public void test_isNotFalse_Boolean() {
-        assertTrue(BooleanUtils.isNotFalse(Boolean.TRUE));
-        assertFalse(BooleanUtils.isNotFalse(Boolean.FALSE));
-        assertTrue(BooleanUtils.isNotFalse(null));
+    public void test_negate_Boolean() {
+        assertSame(null, BooleanUtils.negate(null));
+        assertSame(Boolean.TRUE, BooleanUtils.negate(Boolean.FALSE));
+        assertSame(Boolean.FALSE, BooleanUtils.negate(Boolean.TRUE));
     }
 
-    //-----------------------------------------------------------------------
     @Test
     public void test_toBoolean_Boolean() {
         assertTrue(BooleanUtils.toBoolean(Boolean.TRUE));
@@ -92,18 +77,6 @@ public class BooleanUtilsTest {
     }
 
     @Test
-    public void test_toBooleanDefaultIfNull_Boolean_boolean() {
-        assertTrue(BooleanUtils.toBooleanDefaultIfNull(Boolean.TRUE, true));
-        assertTrue(BooleanUtils.toBooleanDefaultIfNull(Boolean.TRUE, false));
-        assertFalse(BooleanUtils.toBooleanDefaultIfNull(Boolean.FALSE, true));
-        assertFalse(BooleanUtils.toBooleanDefaultIfNull(Boolean.FALSE, false));
-        assertTrue(BooleanUtils.toBooleanDefaultIfNull(null, true));
-        assertFalse(BooleanUtils.toBooleanDefaultIfNull(null, false));
-    }
-
-    //-----------------------------------------------------------------------
-    //-----------------------------------------------------------------------
-    @Test
     public void test_toBoolean_int() {
         assertTrue(BooleanUtils.toBoolean(1));
         assertTrue(BooleanUtils.toBoolean(-1));
@@ -111,22 +84,6 @@ public class BooleanUtilsTest {
     }
 
     @Test
-    public void test_toBooleanObject_int() {
-        assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject(1));
-        assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject(-1));
-        assertEquals(Boolean.FALSE, BooleanUtils.toBooleanObject(0));
-    }
-
-    @Test
-    public void test_toBooleanObject_Integer() {
-        assertEquals(Boolean.TRUE, 
BooleanUtils.toBooleanObject(Integer.valueOf(1)));
-        assertEquals(Boolean.TRUE, 
BooleanUtils.toBooleanObject(Integer.valueOf(-1)));
-        assertEquals(Boolean.FALSE, 
BooleanUtils.toBooleanObject(Integer.valueOf(0)));
-        assertNull(BooleanUtils.toBooleanObject((Integer) null));
-    }
-
-    //-----------------------------------------------------------------------
-    @Test
     public void test_toBoolean_int_int_int() {
         assertTrue(BooleanUtils.toBoolean(6, 6, 7));
         assertFalse(BooleanUtils.toBoolean(7, 6, 7));
@@ -150,18 +107,106 @@ public class BooleanUtilsTest {
     }
 
     @Test
+    public void test_toBoolean_Integer_Integer_Integer_noMatch() {
+        assertThrows(IllegalArgumentException.class,
+                () -> BooleanUtils.toBoolean(Integer.valueOf(8), 
Integer.valueOf(6), Integer.valueOf(7)));
+    }
+
+    @Test
     public void test_toBoolean_Integer_Integer_Integer_nullValue() {
         assertThrows(IllegalArgumentException.class,
                 () -> BooleanUtils.toBoolean(null, Integer.valueOf(6), 
Integer.valueOf(7)));
     }
 
     @Test
-    public void test_toBoolean_Integer_Integer_Integer_noMatch() {
-        assertThrows(IllegalArgumentException.class,
-                () -> BooleanUtils.toBoolean(Integer.valueOf(8), 
Integer.valueOf(6), Integer.valueOf(7)));
+    public void test_toBoolean_String() {
+        assertFalse(BooleanUtils.toBoolean((String) null));
+        assertFalse(BooleanUtils.toBoolean(""));
+        assertFalse(BooleanUtils.toBoolean("off"));
+        assertFalse(BooleanUtils.toBoolean("oof"));
+        assertFalse(BooleanUtils.toBoolean("yep"));
+        assertFalse(BooleanUtils.toBoolean("trux"));
+        assertFalse(BooleanUtils.toBoolean("false"));
+        assertFalse(BooleanUtils.toBoolean("a"));
+        assertTrue(BooleanUtils.toBoolean("true")); // interned handled 
differently
+        assertTrue(BooleanUtils.toBoolean(new 
StringBuilder("tr").append("ue").toString()));
+        assertTrue(BooleanUtils.toBoolean("truE"));
+        assertTrue(BooleanUtils.toBoolean("trUe"));
+        assertTrue(BooleanUtils.toBoolean("trUE"));
+        assertTrue(BooleanUtils.toBoolean("tRue"));
+        assertTrue(BooleanUtils.toBoolean("tRuE"));
+        assertTrue(BooleanUtils.toBoolean("tRUe"));
+        assertTrue(BooleanUtils.toBoolean("tRUE"));
+        assertTrue(BooleanUtils.toBoolean("TRUE"));
+        assertTrue(BooleanUtils.toBoolean("TRUe"));
+        assertTrue(BooleanUtils.toBoolean("TRuE"));
+        assertTrue(BooleanUtils.toBoolean("TRue"));
+        assertTrue(BooleanUtils.toBoolean("TrUE"));
+        assertTrue(BooleanUtils.toBoolean("TrUe"));
+        assertTrue(BooleanUtils.toBoolean("TruE"));
+        assertTrue(BooleanUtils.toBoolean("True"));
+        assertTrue(BooleanUtils.toBoolean("on"));
+        assertTrue(BooleanUtils.toBoolean("oN"));
+        assertTrue(BooleanUtils.toBoolean("On"));
+        assertTrue(BooleanUtils.toBoolean("ON"));
+        assertTrue(BooleanUtils.toBoolean("yes"));
+        assertTrue(BooleanUtils.toBoolean("yeS"));
+        assertTrue(BooleanUtils.toBoolean("yEs"));
+        assertTrue(BooleanUtils.toBoolean("yES"));
+        assertTrue(BooleanUtils.toBoolean("Yes"));
+        assertTrue(BooleanUtils.toBoolean("YeS"));
+        assertTrue(BooleanUtils.toBoolean("YEs"));
+        assertTrue(BooleanUtils.toBoolean("YES"));
+        assertTrue(BooleanUtils.toBoolean("1"));
+        assertFalse(BooleanUtils.toBoolean("yes?"));
+        assertFalse(BooleanUtils.toBoolean("0"));
+        assertFalse(BooleanUtils.toBoolean("tru"));
+
+        assertFalse(BooleanUtils.toBoolean("no"));
+        assertFalse(BooleanUtils.toBoolean("off"));
+        assertFalse(BooleanUtils.toBoolean("yoo"));
+    }
+
+    @Test
+    public void test_toBoolean_String_String_String() {
+        assertTrue(BooleanUtils.toBoolean(null, null, "N"));
+        assertFalse(BooleanUtils.toBoolean(null, "Y", null));
+        assertTrue(BooleanUtils.toBoolean("Y", "Y", "N"));
+        assertTrue(BooleanUtils.toBoolean("Y", new String("Y"), new 
String("N")));
+        assertFalse(BooleanUtils.toBoolean("N", "Y", "N"));
+        assertFalse(BooleanUtils.toBoolean("N", new String("Y"), new 
String("N")));
+        assertTrue(BooleanUtils.toBoolean((String) null, null, null));
+        assertTrue(BooleanUtils.toBoolean("Y", "Y", "Y"));
+        assertTrue(BooleanUtils.toBoolean("Y", new String("Y"), new 
String("Y")));
+    }
+
+    @Test
+    public void test_toBoolean_String_String_String_noMatch() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.toBoolean("X", "Y", "N"));
+    }
+
+    @Test
+    public void test_toBoolean_String_String_String_nullValue() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.toBoolean(null, "Y", "N"));
+    }
+
+    @Test
+    public void test_toBooleanDefaultIfNull_Boolean_boolean() {
+        assertTrue(BooleanUtils.toBooleanDefaultIfNull(Boolean.TRUE, true));
+        assertTrue(BooleanUtils.toBooleanDefaultIfNull(Boolean.TRUE, false));
+        assertFalse(BooleanUtils.toBooleanDefaultIfNull(Boolean.FALSE, true));
+        assertFalse(BooleanUtils.toBooleanDefaultIfNull(Boolean.FALSE, false));
+        assertTrue(BooleanUtils.toBooleanDefaultIfNull(null, true));
+        assertFalse(BooleanUtils.toBooleanDefaultIfNull(null, false));
+    }
+
+    @Test
+    public void test_toBooleanObject_int() {
+        assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject(1));
+        assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject(-1));
+        assertEquals(Boolean.FALSE, BooleanUtils.toBooleanObject(0));
     }
 
-    //-----------------------------------------------------------------------
     @Test
     public void test_toBooleanObject_int_int_int() {
         assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject(6, 6, 7, 8));
@@ -175,6 +220,14 @@ public class BooleanUtilsTest {
     }
 
     @Test
+    public void test_toBooleanObject_Integer() {
+        assertEquals(Boolean.TRUE, 
BooleanUtils.toBooleanObject(Integer.valueOf(1)));
+        assertEquals(Boolean.TRUE, 
BooleanUtils.toBooleanObject(Integer.valueOf(-1)));
+        assertEquals(Boolean.FALSE, 
BooleanUtils.toBooleanObject(Integer.valueOf(0)));
+        assertNull(BooleanUtils.toBooleanObject((Integer) null));
+    }
+
+    @Test
     public void test_toBooleanObject_Integer_Integer_Integer_Integer() {
         final Integer six = Integer.valueOf(6);
         final Integer seven = Integer.valueOf(7);
@@ -190,72 +243,17 @@ public class BooleanUtilsTest {
     }
 
     @Test
-    public void 
test_toBooleanObject_Integer_Integer_Integer_Integer_nullValue() {
-        assertThrows(IllegalArgumentException.class,
-                () -> BooleanUtils.toBooleanObject(null, Integer.valueOf(6), 
Integer.valueOf(7), Integer.valueOf(8)));
-    }
-
-    @Test
     public void test_toBooleanObject_Integer_Integer_Integer_Integer_noMatch() 
{
         assertThrows(IllegalArgumentException.class,
                 () -> BooleanUtils.toBooleanObject(Integer.valueOf(9), 
Integer.valueOf(6), Integer.valueOf(7), Integer.valueOf(8)));
     }
 
-    //-----------------------------------------------------------------------
-    @Test
-    public void test_toInteger_boolean() {
-        assertEquals(1, BooleanUtils.toInteger(true));
-        assertEquals(0, BooleanUtils.toInteger(false));
-    }
-
-    @Test
-    public void test_toIntegerObject_boolean() {
-        assertEquals(Integer.valueOf(1), BooleanUtils.toIntegerObject(true));
-        assertEquals(Integer.valueOf(0), BooleanUtils.toIntegerObject(false));
-    }
-
-    @Test
-    public void test_toIntegerObject_Boolean() {
-        assertEquals(Integer.valueOf(1), 
BooleanUtils.toIntegerObject(Boolean.TRUE));
-        assertEquals(Integer.valueOf(0), 
BooleanUtils.toIntegerObject(Boolean.FALSE));
-        assertNull(BooleanUtils.toIntegerObject(null));
-    }
-
-    //-----------------------------------------------------------------------
-    @Test
-    public void test_toInteger_boolean_int_int() {
-        assertEquals(6, BooleanUtils.toInteger(true, 6, 7));
-        assertEquals(7, BooleanUtils.toInteger(false, 6, 7));
-    }
-
-    @Test
-    public void test_toInteger_Boolean_int_int_int() {
-        assertEquals(6, BooleanUtils.toInteger(Boolean.TRUE, 6, 7, 8));
-        assertEquals(7, BooleanUtils.toInteger(Boolean.FALSE, 6, 7, 8));
-        assertEquals(8, BooleanUtils.toInteger(null, 6, 7, 8));
-    }
-
     @Test
-    public void test_toIntegerObject_boolean_Integer_Integer() {
-        final Integer six = Integer.valueOf(6);
-        final Integer seven = Integer.valueOf(7);
-        assertEquals(six, BooleanUtils.toIntegerObject(true, six, seven));
-        assertEquals(seven, BooleanUtils.toIntegerObject(false, six, seven));
-    }
-
-    @Test
-    public void test_toIntegerObject_Boolean_Integer_Integer_Integer() {
-        final Integer six = Integer.valueOf(6);
-        final Integer seven = Integer.valueOf(7);
-        final Integer eight = Integer.valueOf(8);
-        assertEquals(six, BooleanUtils.toIntegerObject(Boolean.TRUE, six, 
seven, eight));
-        assertEquals(seven, BooleanUtils.toIntegerObject(Boolean.FALSE, six, 
seven, eight));
-        assertEquals(eight, BooleanUtils.toIntegerObject(null, six, seven, 
eight));
-        assertNull(BooleanUtils.toIntegerObject(null, six, seven, null));
+    public void 
test_toBooleanObject_Integer_Integer_Integer_Integer_nullValue() {
+        assertThrows(IllegalArgumentException.class,
+                () -> BooleanUtils.toBooleanObject(null, Integer.valueOf(6), 
Integer.valueOf(7), Integer.valueOf(8)));
     }
 
-    //-----------------------------------------------------------------------
-    //-----------------------------------------------------------------------
     @Test
     public void test_toBooleanObject_String() {
         assertNull(BooleanUtils.toBooleanObject((String) null));
@@ -306,108 +304,70 @@ public class BooleanUtilsTest {
     }
 
     @Test
+    public void test_toBooleanObject_String_String_String_String_noMatch() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.toBooleanObject("X", "Y", "N", "U"));
+    }
+
+    @Test
     public void test_toBooleanObject_String_String_String_String_nullValue() {
         assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.toBooleanObject(null, "Y", "N", "U"));
     }
 
     @Test
-    public void test_toBooleanObject_String_String_String_String_noMatch() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.toBooleanObject("X", "Y", "N", "U"));
+    public void test_toInteger_boolean() {
+        assertEquals(1, BooleanUtils.toInteger(true));
+        assertEquals(0, BooleanUtils.toInteger(false));
     }
 
-    //-----------------------------------------------------------------------
     @Test
-    public void test_toBoolean_String() {
-        assertFalse(BooleanUtils.toBoolean((String) null));
-        assertFalse(BooleanUtils.toBoolean(""));
-        assertFalse(BooleanUtils.toBoolean("off"));
-        assertFalse(BooleanUtils.toBoolean("oof"));
-        assertFalse(BooleanUtils.toBoolean("yep"));
-        assertFalse(BooleanUtils.toBoolean("trux"));
-        assertFalse(BooleanUtils.toBoolean("false"));
-        assertFalse(BooleanUtils.toBoolean("a"));
-        assertTrue(BooleanUtils.toBoolean("true")); // interned handled 
differently
-        assertTrue(BooleanUtils.toBoolean(new 
StringBuilder("tr").append("ue").toString()));
-        assertTrue(BooleanUtils.toBoolean("truE"));
-        assertTrue(BooleanUtils.toBoolean("trUe"));
-        assertTrue(BooleanUtils.toBoolean("trUE"));
-        assertTrue(BooleanUtils.toBoolean("tRue"));
-        assertTrue(BooleanUtils.toBoolean("tRuE"));
-        assertTrue(BooleanUtils.toBoolean("tRUe"));
-        assertTrue(BooleanUtils.toBoolean("tRUE"));
-        assertTrue(BooleanUtils.toBoolean("TRUE"));
-        assertTrue(BooleanUtils.toBoolean("TRUe"));
-        assertTrue(BooleanUtils.toBoolean("TRuE"));
-        assertTrue(BooleanUtils.toBoolean("TRue"));
-        assertTrue(BooleanUtils.toBoolean("TrUE"));
-        assertTrue(BooleanUtils.toBoolean("TrUe"));
-        assertTrue(BooleanUtils.toBoolean("TruE"));
-        assertTrue(BooleanUtils.toBoolean("True"));
-        assertTrue(BooleanUtils.toBoolean("on"));
-        assertTrue(BooleanUtils.toBoolean("oN"));
-        assertTrue(BooleanUtils.toBoolean("On"));
-        assertTrue(BooleanUtils.toBoolean("ON"));
-        assertTrue(BooleanUtils.toBoolean("yes"));
-        assertTrue(BooleanUtils.toBoolean("yeS"));
-        assertTrue(BooleanUtils.toBoolean("yEs"));
-        assertTrue(BooleanUtils.toBoolean("yES"));
-        assertTrue(BooleanUtils.toBoolean("Yes"));
-        assertTrue(BooleanUtils.toBoolean("YeS"));
-        assertTrue(BooleanUtils.toBoolean("YEs"));
-        assertTrue(BooleanUtils.toBoolean("YES"));
-        assertTrue(BooleanUtils.toBoolean("1"));
-        assertFalse(BooleanUtils.toBoolean("yes?"));
-        assertFalse(BooleanUtils.toBoolean("0"));
-        assertFalse(BooleanUtils.toBoolean("tru"));
-
-        assertFalse(BooleanUtils.toBoolean("no"));
-        assertFalse(BooleanUtils.toBoolean("off"));
-        assertFalse(BooleanUtils.toBoolean("yoo"));
+    public void test_toInteger_boolean_int_int() {
+        assertEquals(6, BooleanUtils.toInteger(true, 6, 7));
+        assertEquals(7, BooleanUtils.toInteger(false, 6, 7));
     }
 
     @Test
-    public void test_toBoolean_String_String_String() {
-        assertTrue(BooleanUtils.toBoolean(null, null, "N"));
-        assertFalse(BooleanUtils.toBoolean(null, "Y", null));
-        assertTrue(BooleanUtils.toBoolean("Y", "Y", "N"));
-        assertTrue(BooleanUtils.toBoolean("Y", new String("Y"), new 
String("N")));
-        assertFalse(BooleanUtils.toBoolean("N", "Y", "N"));
-        assertFalse(BooleanUtils.toBoolean("N", new String("Y"), new 
String("N")));
-        assertTrue(BooleanUtils.toBoolean((String) null, null, null));
-        assertTrue(BooleanUtils.toBoolean("Y", "Y", "Y"));
-        assertTrue(BooleanUtils.toBoolean("Y", new String("Y"), new 
String("Y")));
+    public void test_toInteger_Boolean_int_int_int() {
+        assertEquals(6, BooleanUtils.toInteger(Boolean.TRUE, 6, 7, 8));
+        assertEquals(7, BooleanUtils.toInteger(Boolean.FALSE, 6, 7, 8));
+        assertEquals(8, BooleanUtils.toInteger(null, 6, 7, 8));
     }
 
     @Test
-    public void test_toBoolean_String_String_String_nullValue() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.toBoolean(null, "Y", "N"));
+    public void test_toIntegerObject_boolean() {
+        assertEquals(Integer.valueOf(1), BooleanUtils.toIntegerObject(true));
+        assertEquals(Integer.valueOf(0), BooleanUtils.toIntegerObject(false));
     }
 
     @Test
-    public void test_toBoolean_String_String_String_noMatch() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.toBoolean("X", "Y", "N"));
+    public void test_toIntegerObject_Boolean() {
+        assertEquals(Integer.valueOf(1), 
BooleanUtils.toIntegerObject(Boolean.TRUE));
+        assertEquals(Integer.valueOf(0), 
BooleanUtils.toIntegerObject(Boolean.FALSE));
+        assertNull(BooleanUtils.toIntegerObject(null));
     }
 
-    //-----------------------------------------------------------------------
     @Test
-    public void test_toStringTrueFalse_Boolean() {
-        assertNull(BooleanUtils.toStringTrueFalse(null));
-        assertEquals("true", BooleanUtils.toStringTrueFalse(Boolean.TRUE));
-        assertEquals("false", BooleanUtils.toStringTrueFalse(Boolean.FALSE));
+    public void test_toIntegerObject_boolean_Integer_Integer() {
+        final Integer six = Integer.valueOf(6);
+        final Integer seven = Integer.valueOf(7);
+        assertEquals(six, BooleanUtils.toIntegerObject(true, six, seven));
+        assertEquals(seven, BooleanUtils.toIntegerObject(false, six, seven));
     }
 
     @Test
-    public void test_toStringOnOff_Boolean() {
-        assertNull(BooleanUtils.toStringOnOff(null));
-        assertEquals("on", BooleanUtils.toStringOnOff(Boolean.TRUE));
-        assertEquals("off", BooleanUtils.toStringOnOff(Boolean.FALSE));
+    public void test_toIntegerObject_Boolean_Integer_Integer_Integer() {
+        final Integer six = Integer.valueOf(6);
+        final Integer seven = Integer.valueOf(7);
+        final Integer eight = Integer.valueOf(8);
+        assertEquals(six, BooleanUtils.toIntegerObject(Boolean.TRUE, six, 
seven, eight));
+        assertEquals(seven, BooleanUtils.toIntegerObject(Boolean.FALSE, six, 
seven, eight));
+        assertEquals(eight, BooleanUtils.toIntegerObject(null, six, seven, 
eight));
+        assertNull(BooleanUtils.toIntegerObject(null, six, seven, null));
     }
 
     @Test
-    public void test_toStringYesNo_Boolean() {
-        assertNull(BooleanUtils.toStringYesNo(null));
-        assertEquals("yes", BooleanUtils.toStringYesNo(Boolean.TRUE));
-        assertEquals("no", BooleanUtils.toStringYesNo(Boolean.FALSE));
+    public void test_toString_boolean_String_String_String() {
+        assertEquals("Y", BooleanUtils.toString(true, "Y", "N"));
+        assertEquals("N", BooleanUtils.toString(false, "Y", "N"));
     }
 
     @Test
@@ -417,13 +377,6 @@ public class BooleanUtilsTest {
         assertEquals("N", BooleanUtils.toString(Boolean.FALSE, "Y", "N", "U"));
     }
 
-    //-----------------------------------------------------------------------
-    @Test
-    public void test_toStringTrueFalse_boolean() {
-        assertEquals("true", BooleanUtils.toStringTrueFalse(true));
-        assertEquals("false", BooleanUtils.toStringTrueFalse(false));
-    }
-
     @Test
     public void test_toStringOnOff_boolean() {
         assertEquals("on", BooleanUtils.toStringOnOff(true));
@@ -431,229 +384,163 @@ public class BooleanUtilsTest {
     }
 
     @Test
-    public void test_toStringYesNo_boolean() {
-        assertEquals("yes", BooleanUtils.toStringYesNo(true));
-        assertEquals("no", BooleanUtils.toStringYesNo(false));
-    }
-
-    @Test
-    public void test_toString_boolean_String_String_String() {
-        assertEquals("Y", BooleanUtils.toString(true, "Y", "N"));
-        assertEquals("N", BooleanUtils.toString(false, "Y", "N"));
+    public void test_toStringOnOff_Boolean() {
+        assertNull(BooleanUtils.toStringOnOff(null));
+        assertEquals("on", BooleanUtils.toStringOnOff(Boolean.TRUE));
+        assertEquals("off", BooleanUtils.toStringOnOff(Boolean.FALSE));
     }
 
-    //  testXor
-    //  -----------------------------------------------------------------------
     @Test
-    public void testXor_primitive_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.xor((boolean[]) null));
+    public void test_toStringTrueFalse_boolean() {
+        assertEquals("true", BooleanUtils.toStringTrueFalse(true));
+        assertEquals("false", BooleanUtils.toStringTrueFalse(false));
     }
 
     @Test
-    public void testXor_primitive_emptyInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.xor(new boolean[] {}));
+    public void test_toStringTrueFalse_Boolean() {
+        assertNull(BooleanUtils.toStringTrueFalse(null));
+        assertEquals("true", BooleanUtils.toStringTrueFalse(Boolean.TRUE));
+        assertEquals("false", BooleanUtils.toStringTrueFalse(Boolean.FALSE));
     }
 
     @Test
-    public void testXor_primitive_validInput_2items() {
-        assertEquals(
-                true ^ true,
-                BooleanUtils.xor(new boolean[] { true, true }),
-                "true ^ true");
-
-        assertEquals(
-                false ^ false,
-                BooleanUtils.xor(new boolean[] { false, false }),
-                "false ^ false");
-
-        assertEquals(
-                true ^ false,
-                BooleanUtils.xor(new boolean[] { true, false }),
-                "true ^ false");
-
-        assertEquals(
-                false ^ true,
-                BooleanUtils.xor(new boolean[] { false, true }),
-                "false ^ true");
+    public void test_toStringYesNo_boolean() {
+        assertEquals("yes", BooleanUtils.toStringYesNo(true));
+        assertEquals("no", BooleanUtils.toStringYesNo(false));
     }
 
     @Test
-    public void testXor_primitive_validInput_3items() {
-        assertEquals(
-                false ^ false ^ false,
-                BooleanUtils.xor(new boolean[] { false, false, false }),
-                "false ^ false ^ false");
-
-        assertEquals(
-                false ^ false ^ true,
-                BooleanUtils.xor(new boolean[] { false, false, true }),
-                "false ^ false ^ true");
-
-        assertEquals(
-                false ^ true ^ false,
-                BooleanUtils.xor(new boolean[] { false, true, false }),
-                "false ^ true ^ false");
-
-        assertEquals(
-                false ^ true ^ true,
-                BooleanUtils.xor(new boolean[] { false, true, true }),
-                "false ^ true ^ true");
-
-        assertEquals(
-                true ^ false ^ false,
-                BooleanUtils.xor(new boolean[] { true, false, false }),
-                "true ^ false ^ false");
-
-        assertEquals(
-                true ^ false ^ true,
-                BooleanUtils.xor(new boolean[] { true, false, true }),
-                "true ^ false ^ true");
-
-        assertEquals(
-                true ^ true ^ false,
-                BooleanUtils.xor(new boolean[] { true, true, false }),
-                "true ^ true ^ false");
-
-        assertEquals(
-                true ^ true ^ true,
-                BooleanUtils.xor(new boolean[] { true, true, true }),
-                "true ^ true ^ true");
+    public void test_toStringYesNo_Boolean() {
+        assertNull(BooleanUtils.toStringYesNo(null));
+        assertEquals("yes", BooleanUtils.toStringYesNo(Boolean.TRUE));
+        assertEquals("no", BooleanUtils.toStringYesNo(Boolean.FALSE));
     }
 
     @Test
-    public void testXor_object_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.xor((Boolean[]) null));
+    public void testAnd_object_emptyInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.and(new Boolean[] {}));
     }
 
     @Test
-    public void testXor_object_emptyInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.xor(new Boolean[] {}));
+    public void testAnd_object_nullElementInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.and(new Boolean[] {null}));
     }
 
     @Test
-    public void testXor_object_nullElementInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.xor(new Boolean[] {null}));
+    public void testAnd_object_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.and((Boolean[]) null));
     }
 
     @Test
-    public void testXor_object_validInput_2items() {
-        assertEquals(
-                false ^ false,
-                BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE 
}).booleanValue(),
-                "false ^ false");
+    public void testAnd_object_validInput_2items() {
+        assertTrue(
+                BooleanUtils
+                    .and(new Boolean[] { Boolean.TRUE, Boolean.TRUE })
+                    .booleanValue(),
+                "False result for (true, true)");
 
-        assertEquals(
-                false ^ true,
-                BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.TRUE 
}).booleanValue(),
-                "false ^ true");
+        assertTrue(
+                ! BooleanUtils
+                    .and(new Boolean[] { Boolean.FALSE, Boolean.FALSE })
+                    .booleanValue(),
+                "True result for (false, false)");
 
-        assertEquals(
-                true ^ false,
-                BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE 
}).booleanValue(),
-                "true ^ false");
+        assertTrue(
+                ! BooleanUtils
+                    .and(new Boolean[] { Boolean.TRUE, Boolean.FALSE })
+                    .booleanValue(),
+                "True result for (true, false)");
 
-        assertEquals(
-                true ^ true,
-                BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE 
}).booleanValue(),
-                "true ^ true");
+        assertTrue(
+                ! BooleanUtils
+                    .and(new Boolean[] { Boolean.FALSE, Boolean.TRUE })
+                    .booleanValue(),
+                "True result for (false, true)");
     }
 
     @Test
-    public void testXor_object_validInput_3items() {
-        assertEquals(
-                false ^ false ^ false,
-                BooleanUtils.xor(
-                                new Boolean[] {
-                                        Boolean.FALSE,
-                                        Boolean.FALSE,
-                                        Boolean.FALSE })
-                                .booleanValue(),
-                "false ^ false ^ false");
+    public void testAnd_object_validInput_3items() {
+        assertTrue(
+                ! BooleanUtils
+                    .and(
+                        new Boolean[] {
+                            Boolean.FALSE,
+                            Boolean.FALSE,
+                            Boolean.TRUE })
+                            .booleanValue(),
+                "True result for (false, false, true)");
 
-        assertEquals(
-                false ^ false ^ true,
-                BooleanUtils
-                        .xor(
-                            new Boolean[] {
-                                Boolean.FALSE,
-                                Boolean.FALSE,
-                                Boolean.TRUE })
-                        .booleanValue(),
-                "false ^ false ^ true");
+        assertTrue(
+                ! BooleanUtils
+                    .and(
+                        new Boolean[] {
+                            Boolean.FALSE,
+                            Boolean.TRUE,
+                            Boolean.FALSE })
+                            .booleanValue(),
+                "True result for (false, true, false)");
 
-        assertEquals(
-                false ^ true ^ false,
-                BooleanUtils
-                        .xor(
-                            new Boolean[] {
-                                Boolean.FALSE,
-                                Boolean.TRUE,
-                                Boolean.FALSE })
-                        .booleanValue(),
-                "false ^ true ^ false");
+        assertTrue(
+                ! BooleanUtils
+                    .and(
+                        new Boolean[] {
+                            Boolean.TRUE,
+                            Boolean.FALSE,
+                            Boolean.FALSE })
+                            .booleanValue(),
+                "True result for (true, false, false)");
 
-        assertEquals(
-                true ^ false ^ false,
+        assertTrue(
                 BooleanUtils
-                        .xor(
-                            new Boolean[] {
-                                Boolean.TRUE,
-                                Boolean.FALSE,
-                                Boolean.FALSE })
-                        .booleanValue(),
-                "true ^ false ^ false");
+                    .and(new Boolean[] { Boolean.TRUE, Boolean.TRUE, 
Boolean.TRUE })
+                    .booleanValue(),
+                "False result for (true, true, true)");
 
-        assertEquals(
-                true ^ false ^ true,
-                BooleanUtils.xor(
-                                new Boolean[] {
-                                        Boolean.TRUE,
-                                        Boolean.FALSE,
-                                        Boolean.TRUE })
-                                .booleanValue(),
-                "true ^ false ^ true");
+        assertTrue(
+                ! BooleanUtils.and(
+                        new Boolean[] {
+                            Boolean.FALSE,
+                            Boolean.FALSE,
+                            Boolean.FALSE })
+                            .booleanValue(),
+                "True result for (false, false)");
 
-        assertEquals(
-                true ^ true ^ false,
-                BooleanUtils.xor(
-                            new Boolean[] {
-                                Boolean.TRUE,
-                                Boolean.TRUE,
-                                Boolean.FALSE })
-                        .booleanValue(),
-                "true ^ true ^ false");
+        assertTrue(
+                ! BooleanUtils.and(
+                        new Boolean[] {
+                            Boolean.TRUE,
+                            Boolean.TRUE,
+                            Boolean.FALSE })
+                            .booleanValue(),
+                "True result for (true, true, false)");
 
-        assertEquals(
-                false ^ true ^ true,
-                BooleanUtils.xor(
-                            new Boolean[] {
-                                Boolean.FALSE,
-                                Boolean.TRUE,
-                                Boolean.TRUE })
-                        .booleanValue(),
-                "false ^ true ^ true");
+        assertTrue(
+                ! BooleanUtils.and(
+                        new Boolean[] {
+                            Boolean.TRUE,
+                            Boolean.FALSE,
+                            Boolean.TRUE })
+                            .booleanValue(),
+                "True result for (true, false, true)");
 
-        assertEquals(
-                true ^ true ^ true,
-                BooleanUtils.xor(
+        assertTrue(
+                ! BooleanUtils.and(
                         new Boolean[] {
-                                Boolean.TRUE,
-                                Boolean.TRUE,
-                                Boolean.TRUE })
-                        .booleanValue(),
-                "true ^ true ^ true");
+                            Boolean.FALSE,
+                            Boolean.TRUE,
+                            Boolean.TRUE })
+                            .booleanValue(),
+                "True result for (false, true, true)");
     }
 
-    //  testAnd
-    //  -----------------------------------------------------------------------
     @Test
-    public void testAnd_primitive_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.and((boolean[]) null));
+    public void testAnd_primitive_emptyInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.and(new boolean[] {}));
     }
 
     @Test
-    public void testAnd_primitive_emptyInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.and(new boolean[] {}));
+    public void testAnd_primitive_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.and((boolean[]) null));
     }
 
     @Test
@@ -711,87 +598,105 @@ public class BooleanUtilsTest {
     }
 
     @Test
-    public void testAnd_object_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.and((Boolean[]) null));
+    public void testCompare() {
+        assertTrue(BooleanUtils.compare(true, false) > 0);
+        assertEquals(0, BooleanUtils.compare(true, true));
+        assertEquals(0, BooleanUtils.compare(false, false));
+        assertTrue(BooleanUtils.compare(false, true) < 0);
     }
 
     @Test
-    public void testAnd_object_emptyInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.and(new Boolean[] {}));
+    public void testConstructor() {
+        assertNotNull(new BooleanUtils());
+        final Constructor<?>[] cons = 
BooleanUtils.class.getDeclaredConstructors();
+        assertEquals(1, cons.length);
+        assertTrue(Modifier.isPublic(cons[0].getModifiers()));
+        assertTrue(Modifier.isPublic(BooleanUtils.class.getModifiers()));
+        assertFalse(Modifier.isFinal(BooleanUtils.class.getModifiers()));
     }
 
     @Test
-    public void testAnd_object_nullElementInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.and(new Boolean[] {null}));
+    public void testOr_object_emptyInput() {
+        assertThrows(IllegalArgumentException.class, () -> BooleanUtils.or(new 
Boolean[] {}));
     }
 
     @Test
-    public void testAnd_object_validInput_2items() {
+    public void testOr_object_nullElementInput() {
+        assertThrows(IllegalArgumentException.class, () -> BooleanUtils.or(new 
Boolean[] {null}));
+    }
+
+    @Test
+    public void testOr_object_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.or((Boolean[]) null));
+    }
+
+    @Test
+    public void testOr_object_validInput_2items() {
         assertTrue(
                 BooleanUtils
-                    .and(new Boolean[] { Boolean.TRUE, Boolean.TRUE })
+                    .or(new Boolean[] { Boolean.TRUE, Boolean.TRUE })
                     .booleanValue(),
                 "False result for (true, true)");
 
         assertTrue(
                 ! BooleanUtils
-                    .and(new Boolean[] { Boolean.FALSE, Boolean.FALSE })
+                    .or(new Boolean[] { Boolean.FALSE, Boolean.FALSE })
                     .booleanValue(),
                 "True result for (false, false)");
 
         assertTrue(
-                ! BooleanUtils
-                    .and(new Boolean[] { Boolean.TRUE, Boolean.FALSE })
+                BooleanUtils
+                    .or(new Boolean[] { Boolean.TRUE, Boolean.FALSE })
                     .booleanValue(),
-                "True result for (true, false)");
+                "False result for (true, false)");
 
         assertTrue(
-                ! BooleanUtils
-                    .and(new Boolean[] { Boolean.FALSE, Boolean.TRUE })
+                BooleanUtils
+                    .or(new Boolean[] { Boolean.FALSE, Boolean.TRUE })
                     .booleanValue(),
-                "True result for (false, true)");
+                "False result for (false, true)");
     }
 
     @Test
-    public void testAnd_object_validInput_3items() {
+    public void testOr_object_validInput_3items() {
         assertTrue(
-                ! BooleanUtils
-                    .and(
+                BooleanUtils
+                    .or(
                         new Boolean[] {
                             Boolean.FALSE,
                             Boolean.FALSE,
                             Boolean.TRUE })
                             .booleanValue(),
-                "True result for (false, false, true)");
+                "False result for (false, false, true)");
 
         assertTrue(
-                ! BooleanUtils
-                    .and(
+                BooleanUtils
+                    .or(
                         new Boolean[] {
                             Boolean.FALSE,
                             Boolean.TRUE,
                             Boolean.FALSE })
                             .booleanValue(),
-                "True result for (false, true, false)");
+                "False result for (false, true, false)");
 
         assertTrue(
-                ! BooleanUtils
-                    .and(
+                BooleanUtils
+                    .or(
                         new Boolean[] {
                             Boolean.TRUE,
                             Boolean.FALSE,
                             Boolean.FALSE })
                             .booleanValue(),
-                "True result for (true, false, false)");
+                "False result for (true, false, false)");
 
         assertTrue(
                 BooleanUtils
-                    .and(new Boolean[] { Boolean.TRUE, Boolean.TRUE, 
Boolean.TRUE })
+                    .or(new Boolean[] { Boolean.TRUE, Boolean.TRUE, 
Boolean.TRUE })
                     .booleanValue(),
                 "False result for (true, true, true)");
 
         assertTrue(
-                ! BooleanUtils.and(
+                ! BooleanUtils.or(
                         new Boolean[] {
                             Boolean.FALSE,
                             Boolean.FALSE,
@@ -800,43 +705,41 @@ public class BooleanUtilsTest {
                 "True result for (false, false)");
 
         assertTrue(
-                ! BooleanUtils.and(
+                BooleanUtils.or(
                         new Boolean[] {
                             Boolean.TRUE,
                             Boolean.TRUE,
                             Boolean.FALSE })
                             .booleanValue(),
-                "True result for (true, true, false)");
+                "False result for (true, true, false)");
 
         assertTrue(
-                ! BooleanUtils.and(
+                BooleanUtils.or(
                         new Boolean[] {
                             Boolean.TRUE,
                             Boolean.FALSE,
                             Boolean.TRUE })
                             .booleanValue(),
-                "True result for (true, false, true)");
+                "False result for (true, false, true)");
 
         assertTrue(
-                ! BooleanUtils.and(
+                BooleanUtils.or(
                         new Boolean[] {
                             Boolean.FALSE,
                             Boolean.TRUE,
                             Boolean.TRUE })
                             .booleanValue(),
-                "True result for (false, true, true)");
+                "False result for (false, true, true)");
     }
 
-    //  testOr
-    //  -----------------------------------------------------------------------
     @Test
-    public void testOr_primitive_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.or((boolean[]) null));
+    public void testOr_primitive_emptyInput() {
+        assertThrows(IllegalArgumentException.class, () -> BooleanUtils.or(new 
boolean[] {}));
     }
 
     @Test
-    public void testOr_primitive_emptyInput() {
-        assertThrows(IllegalArgumentException.class, () -> BooleanUtils.or(new 
boolean[] {}));
+    public void testOr_primitive_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.or((boolean[]) null));
     }
 
     @Test
@@ -893,129 +796,204 @@ public class BooleanUtilsTest {
                 "False result for (false, true, true)");
 
     }
+
     @Test
-    public void testOr_object_nullInput() {
-        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.or((Boolean[]) null));
+    public void testXor_object_emptyInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.xor(new Boolean[] {}));
     }
 
     @Test
-    public void testOr_object_emptyInput() {
-        assertThrows(IllegalArgumentException.class, () -> BooleanUtils.or(new 
Boolean[] {}));
+    public void testXor_object_nullElementInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.xor(new Boolean[] {null}));
     }
 
     @Test
-    public void testOr_object_nullElementInput() {
-        assertThrows(IllegalArgumentException.class, () -> BooleanUtils.or(new 
Boolean[] {null}));
+    public void testXor_object_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.xor((Boolean[]) null));
     }
-
     @Test
-    public void testOr_object_validInput_2items() {
-        assertTrue(
-                BooleanUtils
-                    .or(new Boolean[] { Boolean.TRUE, Boolean.TRUE })
-                    .booleanValue(),
-                "False result for (true, true)");
+    public void testXor_object_validInput_2items() {
+        assertEquals(
+                false ^ false,
+                BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE 
}).booleanValue(),
+                "false ^ false");
 
-        assertTrue(
-                ! BooleanUtils
-                    .or(new Boolean[] { Boolean.FALSE, Boolean.FALSE })
-                    .booleanValue(),
-                "True result for (false, false)");
+        assertEquals(
+                false ^ true,
+                BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.TRUE 
}).booleanValue(),
+                "false ^ true");
 
-        assertTrue(
-                BooleanUtils
-                    .or(new Boolean[] { Boolean.TRUE, Boolean.FALSE })
-                    .booleanValue(),
-                "False result for (true, false)");
+        assertEquals(
+                true ^ false,
+                BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE 
}).booleanValue(),
+                "true ^ false");
 
-        assertTrue(
-                BooleanUtils
-                    .or(new Boolean[] { Boolean.FALSE, Boolean.TRUE })
-                    .booleanValue(),
-                "False result for (false, true)");
+        assertEquals(
+                true ^ true,
+                BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE 
}).booleanValue(),
+                "true ^ true");
     }
 
     @Test
-    public void testOr_object_validInput_3items() {
-        assertTrue(
-                BooleanUtils
-                    .or(
-                        new Boolean[] {
-                            Boolean.FALSE,
-                            Boolean.FALSE,
-                            Boolean.TRUE })
-                            .booleanValue(),
-                "False result for (false, false, true)");
+    public void testXor_object_validInput_3items() {
+        assertEquals(
+                false ^ false ^ false,
+                BooleanUtils.xor(
+                                new Boolean[] {
+                                        Boolean.FALSE,
+                                        Boolean.FALSE,
+                                        Boolean.FALSE })
+                                .booleanValue(),
+                "false ^ false ^ false");
 
-        assertTrue(
+        assertEquals(
+                false ^ false ^ true,
                 BooleanUtils
-                    .or(
-                        new Boolean[] {
-                            Boolean.FALSE,
-                            Boolean.TRUE,
-                            Boolean.FALSE })
-                            .booleanValue(),
-                "False result for (false, true, false)");
+                        .xor(
+                            new Boolean[] {
+                                Boolean.FALSE,
+                                Boolean.FALSE,
+                                Boolean.TRUE })
+                        .booleanValue(),
+                "false ^ false ^ true");
 
-        assertTrue(
+        assertEquals(
+                false ^ true ^ false,
                 BooleanUtils
-                    .or(
-                        new Boolean[] {
-                            Boolean.TRUE,
-                            Boolean.FALSE,
-                            Boolean.FALSE })
-                            .booleanValue(),
-                "False result for (true, false, false)");
+                        .xor(
+                            new Boolean[] {
+                                Boolean.FALSE,
+                                Boolean.TRUE,
+                                Boolean.FALSE })
+                        .booleanValue(),
+                "false ^ true ^ false");
 
-        assertTrue(
+        assertEquals(
+                true ^ false ^ false,
                 BooleanUtils
-                    .or(new Boolean[] { Boolean.TRUE, Boolean.TRUE, 
Boolean.TRUE })
-                    .booleanValue(),
-                "False result for (true, true, true)");
+                        .xor(
+                            new Boolean[] {
+                                Boolean.TRUE,
+                                Boolean.FALSE,
+                                Boolean.FALSE })
+                        .booleanValue(),
+                "true ^ false ^ false");
 
-        assertTrue(
-                ! BooleanUtils.or(
-                        new Boolean[] {
-                            Boolean.FALSE,
-                            Boolean.FALSE,
-                            Boolean.FALSE })
-                            .booleanValue(),
-                "True result for (false, false)");
+        assertEquals(
+                true ^ false ^ true,
+                BooleanUtils.xor(
+                                new Boolean[] {
+                                        Boolean.TRUE,
+                                        Boolean.FALSE,
+                                        Boolean.TRUE })
+                                .booleanValue(),
+                "true ^ false ^ true");
 
-        assertTrue(
-                BooleanUtils.or(
-                        new Boolean[] {
-                            Boolean.TRUE,
-                            Boolean.TRUE,
-                            Boolean.FALSE })
-                            .booleanValue(),
-                "False result for (true, true, false)");
+        assertEquals(
+                true ^ true ^ false,
+                BooleanUtils.xor(
+                            new Boolean[] {
+                                Boolean.TRUE,
+                                Boolean.TRUE,
+                                Boolean.FALSE })
+                        .booleanValue(),
+                "true ^ true ^ false");
 
-        assertTrue(
-                BooleanUtils.or(
-                        new Boolean[] {
-                            Boolean.TRUE,
-                            Boolean.FALSE,
-                            Boolean.TRUE })
-                            .booleanValue(),
-                "False result for (true, false, true)");
+        assertEquals(
+                false ^ true ^ true,
+                BooleanUtils.xor(
+                            new Boolean[] {
+                                Boolean.FALSE,
+                                Boolean.TRUE,
+                                Boolean.TRUE })
+                        .booleanValue(),
+                "false ^ true ^ true");
 
-        assertTrue(
-                BooleanUtils.or(
+        assertEquals(
+                true ^ true ^ true,
+                BooleanUtils.xor(
                         new Boolean[] {
-                            Boolean.FALSE,
-                            Boolean.TRUE,
-                            Boolean.TRUE })
-                            .booleanValue(),
-                "False result for (false, true, true)");
+                                Boolean.TRUE,
+                                Boolean.TRUE,
+                                Boolean.TRUE })
+                        .booleanValue(),
+                "true ^ true ^ true");
     }
 
     @Test
-    public void testCompare() {
-        assertTrue(BooleanUtils.compare(true, false) > 0);
-        assertEquals(0, BooleanUtils.compare(true, true));
-        assertEquals(0, BooleanUtils.compare(false, false));
-        assertTrue(BooleanUtils.compare(false, true) < 0);
+    public void testXor_primitive_emptyInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.xor(new boolean[] {}));
+    }
+
+    @Test
+    public void testXor_primitive_nullInput() {
+        assertThrows(IllegalArgumentException.class, () -> 
BooleanUtils.xor((boolean[]) null));
+    }
+
+    @Test
+    public void testXor_primitive_validInput_2items() {
+        assertEquals(
+                true ^ true,
+                BooleanUtils.xor(new boolean[] { true, true }),
+                "true ^ true");
+
+        assertEquals(
+                false ^ false,
+                BooleanUtils.xor(new boolean[] { false, false }),
+                "false ^ false");
+
+        assertEquals(
+                true ^ false,
+                BooleanUtils.xor(new boolean[] { true, false }),
+                "true ^ false");
+
+        assertEquals(
+                false ^ true,
+                BooleanUtils.xor(new boolean[] { false, true }),
+                "false ^ true");
+    }
+
+    @Test
+    public void testXor_primitive_validInput_3items() {
+        assertEquals(
+                false ^ false ^ false,
+                BooleanUtils.xor(new boolean[] { false, false, false }),
+                "false ^ false ^ false");
+
+        assertEquals(
+                false ^ false ^ true,
+                BooleanUtils.xor(new boolean[] { false, false, true }),
+                "false ^ false ^ true");
+
+        assertEquals(
+                false ^ true ^ false,
+                BooleanUtils.xor(new boolean[] { false, true, false }),
+                "false ^ true ^ false");
+
+        assertEquals(
+                false ^ true ^ true,
+                BooleanUtils.xor(new boolean[] { false, true, true }),
+                "false ^ true ^ true");
+
+        assertEquals(
+                true ^ false ^ false,
+                BooleanUtils.xor(new boolean[] { true, false, false }),
+                "true ^ false ^ false");
+
+        assertEquals(
+                true ^ false ^ true,
+                BooleanUtils.xor(new boolean[] { true, false, true }),
+                "true ^ false ^ true");
+
+        assertEquals(
+                true ^ true ^ false,
+                BooleanUtils.xor(new boolean[] { true, true, false }),
+                "true ^ true ^ false");
+
+        assertEquals(
+                true ^ true ^ true,
+                BooleanUtils.xor(new boolean[] { true, true, true }),
+                "true ^ true ^ true");
     }
 
 }

Reply via email to