1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 }