1 /**
2 * Copyright (c) 2004-2011 QOS.ch
3 * All rights reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26 package org.apache.commons.logging;
27
28 import junit.framework.TestCase;
29
30
31 public class InvokeJCLTest extends TestCase {
32
33 public void testIsEnabledAPI() {
34 // assume that we are running over slf4j-jdk14
35 Log log = LogFactory.getLog(InvokeJCLTest.class);
36 assertFalse(log.isTraceEnabled());
37 assertFalse(log.isDebugEnabled());
38 assertTrue(log.isInfoEnabled());
39 assertTrue(log.isWarnEnabled());
40 assertTrue(log.isErrorEnabled());
41 assertTrue(log.isFatalEnabled());
42 }
43
44 public void testPrintAPI() {
45 Log log = LogFactory.getLog(InvokeJCLTest.class);
46 Exception e = new Exception("just testing");
47
48 log.trace(null);
49 log.trace("trace message");
50
51 log.debug(null);
52 log.debug("debug message");
53
54 log.info(null);
55 log.info("info message");
56
57 log.warn(null);
58 log.warn("warn message");
59
60 log.error(null);
61 log.error("error message");
62
63 log.fatal(null);
64 log.fatal("fatal message");
65
66
67 log.trace(null, e);
68 log.trace("trace message", e);
69
70 log.debug(null, e);
71 log.debug("debug message", e);
72
73 log.info(null, e);
74 log.info("info message", e);
75
76 log.warn(null, e);
77 log.warn("warn message", e);
78
79 log.error(null, e);
80 log.error("error message", e);
81
82 log.fatal(null, e);
83 log.fatal("fatal message", e);
84 }
85 }