commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject svn commit: r830029 - in /commons/proper/lang/trunk/src: java/org/apache/commons/lang/mutable/MutableBoolean.java test/org/apache/commons/lang/mutable/MutableBooleanTest.java
Date Mon, 26 Oct 2009 23:53:42 GMT
Author: scolebourne
Date: Mon Oct 26 23:53:41 2009
New Revision: 830029

URL: http://svn.apache.org/viewvc?rev=830029&view=rev
Log:
Add isTrue/isFalse methods

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
    commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableBooleanTest.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java?rev=830029&r1=830028&r2=830029&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
(original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
Mon Oct 26 23:53:41 2009
@@ -98,6 +98,25 @@
 
     //-----------------------------------------------------------------------
     /**
+     * Checks if the current value is <code>true</code>.
+     * 
+     * @return <code>true</code> if the current value is <code>true</code>
+     */
+    public boolean isTrue() {
+        return value == true;
+    }
+
+    /**
+     * Checks if the current value is <code>false</code>.
+     * 
+     * @return <code>true</code> if the current value is <code>false</code>
+     */
+    public boolean isFalse() {
+        return value == false;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Returns the value of this MutableBoolean as a boolean.
      * 
      * @return the boolean value represented by this object.

Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableBooleanTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableBooleanTest.java?rev=830029&r1=830028&r2=830029&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableBooleanTest.java
(original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/mutable/MutableBooleanTest.java
Mon Oct 26 23:53:41 2009
@@ -101,10 +101,14 @@
         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());



Mime
View raw message