1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */ 
16   
17   
18  package org.apache.commons.logging;
19  
20  import junit.framework.TestCase;
21  
22  
23  /***
24    * Generic tests that can be applied to any log adapter by
25    * subclassing this class and defining method getLogObject
26    * appropriately.
27    * 
28    * @author Sean C. Sullivan
29    * @version $Revision: 381236 $
30    */
31  public abstract class AbstractLogTest extends TestCase {
32  
33      public abstract Log getLogObject();
34  
35  	public void testLoggingWithNullParameters()
36  	{
37  		Log log = this.getLogObject();
38  		
39  		assertNotNull(log);
40  		
41  
42  		log.debug(null);
43  		
44  		log.debug(null, null);
45  		
46  		log.debug(log.getClass().getName() + ": debug statement");
47  		
48  		log.debug(log.getClass().getName() + ": debug statement w/ null exception", new RuntimeException());
49  		
50  
51  		log.error(null);
52  		
53  		log.error(null, null);
54  		
55  		log.error(log.getClass().getName() + ": error statement");
56  		
57  		log.error(log.getClass().getName() + ": error statement w/ null exception", new RuntimeException());
58  		
59  
60  		log.fatal(null);
61  		
62  		log.fatal(null, null);
63  		
64  		log.fatal(log.getClass().getName() + ": fatal statement");
65  		
66  		log.fatal(log.getClass().getName() + ": fatal statement w/ null exception", new RuntimeException());
67  		
68  
69  		log.info(null);
70  		
71  		log.info(null, null);
72  		
73  		log.info(log.getClass().getName() + ": info statement");
74  		
75  		log.info(log.getClass().getName() + ": info statement w/ null exception", new RuntimeException());
76  		
77  
78  		log.trace(null);
79  		
80  		log.trace(null, null);
81  		
82  		log.trace(log.getClass().getName() + ": trace statement");
83  		
84  		log.trace(log.getClass().getName() + ": trace statement w/ null exception", new RuntimeException());
85  		
86  
87  		log.warn(null);
88  		
89  		log.warn(null, null);
90  		
91  		log.warn(log.getClass().getName() + ": warn statement");
92  		
93  		log.warn(log.getClass().getName() + ": warn statement w/ null exception", new RuntimeException());
94  	}    
95  }