Example #1
0
  public void testXor_primitive_validInput_2items() {
    assertTrue("True result for (true, true)", !BooleanUtils.xor(new boolean[] {true, true}));

    assertTrue("True result for (false, false)", !BooleanUtils.xor(new boolean[] {false, false}));

    assertTrue("False result for (true, false)", BooleanUtils.xor(new boolean[] {true, false}));

    assertTrue("False result for (false, true)", BooleanUtils.xor(new boolean[] {false, true}));
  }
Example #2
0
 public void testXor_object_nullElementInput() {
   try {
     BooleanUtils.xor(new Boolean[] {null});
     fail("Exception was not thrown for null element input.");
   } catch (IllegalArgumentException ex) {
   }
 }
Example #3
0
 public void testXor_object_emptyInput() {
   try {
     BooleanUtils.xor(new Boolean[] {});
     fail("Exception was not thrown for empty input.");
   } catch (IllegalArgumentException ex) {
   }
 }
Example #4
0
  public void testXor_object_validInput_2items() {
    assertTrue(
        "True result for (true, true)",
        !BooleanUtils.xor(new Boolean[] {Boolean.TRUE, Boolean.TRUE}).booleanValue());

    assertTrue(
        "True result for (false, false)",
        !BooleanUtils.xor(new Boolean[] {Boolean.FALSE, Boolean.FALSE}).booleanValue());

    assertTrue(
        "False result for (true, false)",
        BooleanUtils.xor(new Boolean[] {Boolean.TRUE, Boolean.FALSE}).booleanValue());

    assertTrue(
        "False result for (false, true)",
        BooleanUtils.xor(new Boolean[] {Boolean.FALSE, Boolean.TRUE}).booleanValue());
  }
Example #5
0
 public void testXor_object_nullInput() {
   final Boolean[] b = null;
   try {
     BooleanUtils.xor(b);
     fail("Exception was not thrown for null input.");
   } catch (IllegalArgumentException ex) {
   }
 }
 @Test(expected = IllegalArgumentException.class)
 public void testXor_object_nullElementInput() {
   BooleanUtils.xor(new Boolean[] {null});
 }
 @Test(expected = IllegalArgumentException.class)
 public void testXor_object_nullInput() {
   BooleanUtils.xor((Boolean[]) null);
 }
 @Test(expected = IllegalArgumentException.class)
 public void testXor_primitive_emptyInput() {
   BooleanUtils.xor(new boolean[] {});
 }