public void testHashCode() {
    final MutableBoolean mutBoolA = new MutableBoolean(false);
    final MutableBoolean mutBoolB = new MutableBoolean(false);
    final MutableBoolean mutBoolC = new MutableBoolean(true);

    assertEquals(true, mutBoolA.hashCode() == mutBoolA.hashCode());
    assertEquals(true, mutBoolA.hashCode() == mutBoolB.hashCode());
    assertEquals(false, mutBoolA.hashCode() == mutBoolC.hashCode());
    assertEquals(true, mutBoolA.hashCode() == Boolean.FALSE.hashCode());
    assertEquals(true, mutBoolC.hashCode() == Boolean.TRUE.hashCode());
  }
  public void testCompareTo() {
    final MutableBoolean mutBool = new MutableBoolean(false);

    assertEquals(0, mutBool.compareTo(new MutableBoolean(false)));
    assertEquals(-1, mutBool.compareTo(new MutableBoolean(true)));
    mutBool.setValue(true);
    assertEquals(+1, mutBool.compareTo(new MutableBoolean(false)));
    assertEquals(0, mutBool.compareTo(new MutableBoolean(true)));

    try {
      mutBool.compareTo(null);
      fail();
    } catch (NullPointerException ex) {
    }
  }
  public void testGetSet() {
    assertEquals(false, new MutableBoolean().booleanValue());
    assertEquals(Boolean.FALSE, new MutableBoolean().getValue());

    final MutableBoolean mutBool = new MutableBoolean(false);
    assertEquals(Boolean.FALSE, mutBool.toBoolean());
    assertEquals(false, mutBool.booleanValue());
    assertEquals(true, mutBool.isFalse());
    assertEquals(false, mutBool.isTrue());

    mutBool.setValue(Boolean.TRUE);
    assertEquals(Boolean.TRUE, mutBool.toBoolean());
    assertEquals(true, mutBool.booleanValue());
    assertEquals(false, mutBool.isFalse());
    assertEquals(true, mutBool.isTrue());

    mutBool.setValue(false);
    assertEquals(false, mutBool.booleanValue());

    mutBool.setValue(true);
    assertEquals(true, mutBool.booleanValue());

    try {
      mutBool.setValue(null);
      fail();
    } catch (NullPointerException ex) {
    }
  }
  public void testEquals() {
    final MutableBoolean mutBoolA = new MutableBoolean(false);
    final MutableBoolean mutBoolB = new MutableBoolean(false);
    final MutableBoolean mutBoolC = new MutableBoolean(true);

    assertEquals(true, mutBoolA.equals(mutBoolA));
    assertEquals(true, mutBoolA.equals(mutBoolB));
    assertEquals(true, mutBoolB.equals(mutBoolA));
    assertEquals(true, mutBoolB.equals(mutBoolB));
    assertEquals(false, mutBoolA.equals(mutBoolC));
    assertEquals(false, mutBoolB.equals(mutBoolC));
    assertEquals(true, mutBoolC.equals(mutBoolC));
    assertEquals(false, mutBoolA.equals(null));
    assertEquals(false, mutBoolA.equals(Boolean.FALSE));
    assertEquals(false, mutBoolA.equals("false"));
  }