commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r155236 - jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/exception/ExceptionUtilsTestCase.java
Date Thu, 24 Feb 2005 20:26:07 GMT
Author: ggregory
Date: Thu Feb 24 12:26:06 2005
New Revision: 155236

URL: http://svn.apache.org/viewcvs?view=rev&rev=155236
Log:
Fixes http://issues.apache.org/bugzilla/show_bug.cgi?id=33737.
[lang] ExceptionUtils.addCauseMethodName(String) does not check for duplicates.
Fix adds:
 ExceptionUtils.removeCauseMethodName(String)
 ExceptionUtils.isCauseMethodName(String)

Modified:
    jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/exception/ExceptionUtilsTestCase.java

Modified: jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/exception/ExceptionUtilsTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/exception/ExceptionUtilsTestCase.java?view=diff&r1=155235&r2=155236
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/exception/ExceptionUtilsTestCase.java
(original)
+++ jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/exception/ExceptionUtilsTestCase.java
Thu Feb 24 12:26:06 2005
@@ -22,6 +22,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.sql.SQLException;
 
+import junit.framework.Assert;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 import org.apache.commons.lang.SystemUtils;
@@ -32,6 +33,7 @@
  * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  * @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
  * @author Stephen Colebourne
+ * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
  * @since 1.0
  */
 public class ExceptionUtilsTestCase extends junit.framework.TestCase {
@@ -76,6 +78,30 @@
     }
 
     //-----------------------------------------------------------------------
+    
+    public void testCauseMethodNameOps() {
+        this.testCauseMethodNameOps(null);
+        this.testCauseMethodNameOps("");
+        this.testCauseMethodNameOps(" ");
+        this.testCauseMethodNameOps("\t\r\n\t");
+        this.testCauseMethodNameOps("testMethodName");
+    }
+    
+    void testCauseMethodNameOps(String name) {
+        String methodName = "testMethodName";
+        try {
+            Assert.assertFalse(ExceptionUtils.isCauseMethodName(methodName));
+            ExceptionUtils.addCauseMethodName(methodName);            
+            ExceptionUtils.addCauseMethodName(methodName);            
+            Assert.assertTrue(ExceptionUtils.isCauseMethodName(methodName));
+        } finally {
+            ExceptionUtils.removeCauseMethodName(methodName);
+            Assert.assertFalse(
+                    "The method name " + methodName + " should not be in the array", 
+                    ExceptionUtils.isCauseMethodName(methodName));
+        }
+    }
+    
     public void testGetCause_Throwable() {
         assertSame(null, ExceptionUtils.getCause(null));
         assertSame(null, ExceptionUtils.getCause(withoutCause));



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message