1 16 17 package org.apache.commons.logging; 18 19 import junit.framework.*; 20 21 28 public class AltHashtableTestCase extends TestCase { 29 30 public static Test suite() throws Exception { 31 Class thisClass = AltHashtableTestCase.class; 32 ClassLoader thisClassLoader = thisClass.getClassLoader(); 33 34 PathableClassLoader loader = new PathableClassLoader(null); 35 loader.useExplicitLoader("junit.", thisClassLoader); 36 loader.addLogicalLib("testclasses"); 37 loader.addLogicalLib("commons-logging"); 38 39 Class testClass = loader.loadClass(thisClass.getName()); 40 return new PathableTestSuite(testClass, loader); 41 } 42 43 56 public void setUp() { 57 System.setProperty( 58 "org.apache.commons.logging.LogFactory.HashtableImpl", 59 AltHashtable.class.getName()); 60 } 61 62 67 public void testType() { 68 assertTrue(LogFactory.factories instanceof AltHashtable); 75 } 76 77 84 public void testPutCalled() throws Exception { 85 AltHashtable.lastKey = null; 86 AltHashtable.lastValue = null; 87 88 LogFactory.getLog(AltHashtableTestCase.class); 89 ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); 90 assertEquals(contextLoader, AltHashtable.lastKey); 91 assertNotNull(AltHashtable.lastValue); 92 } 93 } 94 | Popular Tags |