01: /*
02: * Copyright 2001-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.apache.commons.logging;
18:
19: import junit.framework.TestCase;
20:
21: /**
22: * Generic tests that can be applied to any log adapter by
23: * subclassing this class and defining method getLogObject
24: * appropriately.
25: *
26: * @author Sean C. Sullivan
27: * @version $Revision: 381236 $
28: */
29: public abstract class AbstractLogTest extends TestCase {
30:
31: public abstract Log getLogObject();
32:
33: public void testLoggingWithNullParameters() {
34: Log log = this .getLogObject();
35:
36: assertNotNull(log);
37:
38: log.debug(null);
39:
40: log.debug(null, null);
41:
42: log.debug(log.getClass().getName() + ": debug statement");
43:
44: log.debug(log.getClass().getName()
45: + ": debug statement w/ null exception",
46: new RuntimeException());
47:
48: log.error(null);
49:
50: log.error(null, null);
51:
52: log.error(log.getClass().getName() + ": error statement");
53:
54: log.error(log.getClass().getName()
55: + ": error statement w/ null exception",
56: new RuntimeException());
57:
58: log.fatal(null);
59:
60: log.fatal(null, null);
61:
62: log.fatal(log.getClass().getName() + ": fatal statement");
63:
64: log.fatal(log.getClass().getName()
65: + ": fatal statement w/ null exception",
66: new RuntimeException());
67:
68: log.info(null);
69:
70: log.info(null, null);
71:
72: log.info(log.getClass().getName() + ": info statement");
73:
74: log.info(log.getClass().getName()
75: + ": info statement w/ null exception",
76: new RuntimeException());
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()
85: + ": trace statement w/ null exception",
86: new RuntimeException());
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()
95: + ": warn statement w/ null exception",
96: new RuntimeException());
97: }
98: }
|