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