You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by sk...@apache.org on 2007/08/06 17:08:05 UTC

svn commit: r563165 - in /commons/proper/logging/trunk/src/test/org/apache/commons/logging: DummyException.java jdk14/CustomConfigTestCase.java log4j/StandardTests.java simple/CustomConfigTestCase.java

Author: skitching
Date: Mon Aug  6 08:08:05 2007
New Revision: 563165

URL: http://svn.apache.org/viewvc?view=rev&rev=563165
Log:
Use a dummy exception class when calling log(exception). This makes the unit test output less confusing.

Added:
    commons/proper/logging/trunk/src/test/org/apache/commons/logging/DummyException.java
Modified:
    commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java
    commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/StandardTests.java
    commons/proper/logging/trunk/src/test/org/apache/commons/logging/simple/CustomConfigTestCase.java

Added: commons/proper/logging/trunk/src/test/org/apache/commons/logging/DummyException.java
URL: http://svn.apache.org/viewvc/commons/proper/logging/trunk/src/test/org/apache/commons/logging/DummyException.java?view=auto&rev=563165
==============================================================================
--- commons/proper/logging/trunk/src/test/org/apache/commons/logging/DummyException.java (added)
+++ commons/proper/logging/trunk/src/test/org/apache/commons/logging/DummyException.java Mon Aug  6 08:08:05 2007
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */ 
+ 
+package org.apache.commons.logging;
+
+/**
+ * Dummy exception that unit tests create instances of when they want to test
+ * logging of an Exception object.
+ */
+public class DummyException extends Exception {
+	private static final long serialVersionUID = 1L; 
+	public DummyException() {
+		// super("Dummy Exception for unit testing");
+	}
+}

Modified: commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java?view=diff&rev=563165&r1=563164&r2=563165
==============================================================================
--- commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java (original)
+++ commons/proper/logging/trunk/src/test/org/apache/commons/logging/jdk14/CustomConfigTestCase.java Mon Aug  6 08:08:05 2007
@@ -30,6 +30,7 @@
 
 import junit.framework.Test;
 
+import org.apache.commons.logging.DummyException;
 import org.apache.commons.logging.PathableClassLoader;
 import org.apache.commons.logging.PathableTestSuite;
 
@@ -329,7 +330,7 @@
 
     // Log the messages with exceptions
     protected void logExceptionMessages() {
-        Throwable t = new IndexOutOfBoundsException();
+        Throwable t = new DummyException();
         log.trace("trace", t); // Should not actually get logged
         log.debug("debug", t);
         log.info("info", t);

Modified: commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/StandardTests.java
URL: http://svn.apache.org/viewvc/commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/StandardTests.java?view=diff&rev=563165&r1=563164&r2=563165
==============================================================================
--- commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/StandardTests.java (original)
+++ commons/proper/logging/trunk/src/test/org/apache/commons/logging/log4j/StandardTests.java Mon Aug  6 08:08:05 2007
@@ -27,6 +27,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.commons.logging.DummyException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -204,7 +205,7 @@
      * Log messages with exceptions
      */
     private void logExceptionMessages(Log log) {
-        Throwable t = new IndexOutOfBoundsException();
+        Throwable t = new DummyException();
         log.trace("trace", t); // Should not actually get logged
         log.debug("debug", t); // Should not actually get logged
         log.info("info", t);

Modified: commons/proper/logging/trunk/src/test/org/apache/commons/logging/simple/CustomConfigTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/logging/trunk/src/test/org/apache/commons/logging/simple/CustomConfigTestCase.java?view=diff&rev=563165&r1=563164&r2=563165
==============================================================================
--- commons/proper/logging/trunk/src/test/org/apache/commons/logging/simple/CustomConfigTestCase.java (original)
+++ commons/proper/logging/trunk/src/test/org/apache/commons/logging/simple/CustomConfigTestCase.java Mon Aug  6 08:08:05 2007
@@ -24,6 +24,7 @@
 
 import junit.framework.Test;
 
+import org.apache.commons.logging.DummyException;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.PathableClassLoader;
 import org.apache.commons.logging.PathableTestSuite;
@@ -234,7 +235,7 @@
     protected void logExceptionMessages() {
 
         // Generate log records
-        Throwable t = new IndexOutOfBoundsException();
+        Throwable t = new DummyException();
         log.trace("trace", t); // Should not actually get logged
         log.debug("debug", t);
         log.info("info", t);