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.*;
21  
22  
23  /***
24    *
25    * @author Sean C. Sullivan
26    * @version $Revision:  $
27    * 
28    */
29  public abstract class AbstractLogTest extends TestCase {
30  
31      public AbstractLogTest(String testName) {
32          super(testName);
33      }
34  
35      
36      public abstract Log getLogObject();
37  
38  	public void testLoggingWithNullParameters()
39  	{
40  		Log log = this.getLogObject();
41  		
42  		assertNotNull(log);
43  		
44  
45  		log.debug(null);
46  		
47  		log.debug(null, null);
48  		
49  		log.debug(log.getClass().getName() + ": debug statement");
50  		
51  		log.debug(log.getClass().getName() + ": debug statement w/ null exception", new RuntimeException());
52  		
53  
54  		log.error(null);
55  		
56  		log.error(null, null);
57  		
58  		log.error(log.getClass().getName() + ": error statement");
59  		
60  		log.error(log.getClass().getName() + ": error statement w/ null exception", new RuntimeException());
61  		
62  
63  		log.fatal(null);
64  		
65  		log.fatal(null, null);
66  		
67  		log.fatal(log.getClass().getName() + ": fatal statement");
68  		
69  		log.fatal(log.getClass().getName() + ": fatal statement w/ null exception", new RuntimeException());
70  		
71  
72  		log.info(null);
73  		
74  		log.info(null, null);
75  		
76  		log.info(log.getClass().getName() + ": info statement");
77  		
78  		log.info(log.getClass().getName() + ": info statement w/ null exception", new RuntimeException());
79  		
80  
81  		log.trace(null);
82  		
83  		log.trace(null, null);
84  		
85  		log.trace(log.getClass().getName() + ": trace statement");
86  		
87  		log.trace(log.getClass().getName() + ": trace statement w/ null exception", new RuntimeException());
88  		
89  
90  		log.warn(null);
91  		
92  		log.warn(null, null);
93  		
94  		log.warn(log.getClass().getName() + ": warn statement");
95  		
96  		log.warn(log.getClass().getName() + ": warn statement w/ null exception", new RuntimeException());
97  	}    
98  }