1 /*
2 * Copyright 2001-2005 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.getName() };
35 junit.textui.TestRunner.main(testCaseName);
36 }
37
38 //---------------------- unit tests ---------------------------------
39
40 /***
41 * This tests that when getContextClassLoader returns null, the
42 * LogFactory.getLog(name) method still correctly returns the same
43 * log object when called multiple times with the same name.
44 */
45 public void testSameLogObject() throws Exception {
46 // unfortunately, there just isn't any way to emulate JCL being
47 // accessable via the null classloader in "standard" systems, so
48 // we can't include this test in our standard unit tests.
49 }
50 }