01: /*
02: * Copyright (c) 2004-2005 SLF4J.ORG
03: * Copyright (c) 2004-2005 QOS.ch
04: *
05: * All rights reserved.
06: *
07: * Permission is hereby granted, free of charge, to any person obtaining
08: * a copy of this software and associated documentation files (the
09: * "Software"), to deal in the Software without restriction, including
10: * without limitation the rights to use, copy, modify, merge, publish,
11: * distribute, and/or sell copies of the Software, and to permit persons
12: * to whom the Software is furnished to do so, provided that the above
13: * copyright notice(s) and this permission notice appear in all copies of
14: * the Software and that both the above copyright notice(s) and this
15: * permission notice appear in supporting documentation.
16: *
17: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18: * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
20: * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21: * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
22: * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
23: * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
24: * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
25: * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26: *
27: * Except as contained in this notice, the name of a copyright holder
28: * shall not be used in advertising or otherwise to promote the sale, use
29: * or other dealings in this Software without prior written authorization
30: * of the copyright holder.
31: *
32: */
33:
34: package org.apache.commons.logging;
35:
36: import junit.framework.TestCase;
37:
38: public class InvokeJCLTest extends TestCase {
39:
40: public void testIsEnabledAPI() {
41: // assume that we are running over slf4j-simple
42: Log log = LogFactory.getLog(InvokeJCLTest.class);
43: assertFalse(log.isTraceEnabled());
44: assertFalse(log.isDebugEnabled());
45: assertTrue(log.isInfoEnabled());
46: assertTrue(log.isWarnEnabled());
47: assertTrue(log.isErrorEnabled());
48: assertTrue(log.isFatalEnabled());
49: }
50:
51: public void testPrintAPI() {
52: Log log = LogFactory.getLog(InvokeJCLTest.class);
53: Exception e = new Exception("just testing");
54:
55: log.trace(null);
56: log.trace("trace message");
57:
58: log.debug(null);
59: log.debug("debug message");
60:
61: log.info(null);
62: log.info("info message");
63:
64: log.warn(null);
65: log.warn("warn message");
66:
67: log.error(null);
68: log.error("error message");
69:
70: log.fatal(null);
71: log.fatal("fatal message");
72:
73: log.trace(null, e);
74: log.trace("trace message", e);
75:
76: log.debug(null, e);
77: log.debug("debug message", e);
78:
79: log.info(null, e);
80: log.info("info message", e);
81:
82: log.warn(null, e);
83: log.warn("warn message", e);
84:
85: log.error(null, e);
86: log.error("error message", e);
87:
88: log.fatal(null, e);
89: log.fatal("fatal message", e);
90: }
91: }
|