01: /*
02: * Copyright 2001-2005 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: package org.apache.commons.logging;
17:
18: import junit.framework.TestCase;
19:
20: /**
21: * Test cases for situations where getClassLoader or getContextClassLoader
22: * return null. This can happen when using JDK 1.1. It can also happen when
23: * JCL is deployed via the bootclassloader - something that could be done when
24: * using java in embedded systems.
25: */
26: public class NullClassLoaderTestCase extends TestCase {
27:
28: //---------------------- Main ---------------------------------
29:
30: /**
31: * Main method so this test case can be run direct from the command line.
32: */
33: public static void main(String[] args) {
34: String[] testCaseName = { NullClassLoaderTestCase.class
35: .getName() };
36: junit.textui.TestRunner.main(testCaseName);
37: }
38:
39: //---------------------- unit tests ---------------------------------
40:
41: /**
42: * This tests that when getContextClassLoader returns null, the
43: * LogFactory.getLog(name) method still correctly returns the same
44: * log object when called multiple times with the same name.
45: */
46: public void testSameLogObject() throws Exception {
47: // unfortunately, there just isn't any way to emulate JCL being
48: // accessable via the null classloader in "standard" systems, so
49: // we can't include this test in our standard unit tests.
50: }
51: }
|