1 26 27 package net.sourceforge.groboutils.codecoverage.v2.logger; 28 29 import java.io.IOException ; 30 import java.util.Properties ; 31 32 import junit.framework.Test; 33 import junit.framework.TestCase; 34 import net.sourceforge.groboutils.autodoc.v1.AutoDoc; 35 import net.sourceforge.groboutils.codecoverage.v2.IChannelLoggerFactoryUTestI; 36 import net.sourceforge.groboutils.junit.v1.iftc.CxFactory; 37 import net.sourceforge.groboutils.junit.v1.iftc.InterfaceTestSuite; 38 39 40 47 public class DirectoryChannelLoggerFactoryUTest extends TestCase 48 { 49 52 private static final Class THIS_CLASS = DirectoryChannelLoggerFactoryUTest.class; 53 private static final AutoDoc DOC = new AutoDoc( THIS_CLASS ); 54 55 public DirectoryChannelLoggerFactoryUTest( String name ) 56 { 57 super( name ); 58 } 59 60 61 64 65 public void testLoadProperties1() 66 { 67 Properties props = new Properties (); 68 props.put( "x-dir", "1" ); 69 70 DirectoryChannelLoggerFactory f = new DirectoryChannelLoggerFactory(); 71 assertEquals( 72 "Did not get the right directory name.", 73 "1", 74 f.getDirectory( "x-", props ) ); 75 } 76 77 78 public void testLoadProperties2() 79 { 80 Properties props = new Properties (); 81 props.put( "x.dir", "1" ); 82 83 DirectoryChannelLoggerFactory f = new DirectoryChannelLoggerFactory(); 84 assertEquals( 85 "Did not get the right directory name.", 86 DirectoryChannelLoggerFactory.DEFAULT_DIRECTORY, 87 f.getDirectory( "x-", props ) ); 88 } 89 90 91 94 95 96 97 100 101 public static Test suite() 102 { 103 InterfaceTestSuite suite = IChannelLoggerFactoryUTestI.suite(); 104 suite.addTestSuite( THIS_CLASS ); 105 suite.addFactory( new CxFactory( "A" ) { 106 public Object createImplObject() throws IOException { 107 return new DirectoryChannelLoggerFactory(); 108 } 109 } ); 110 111 return suite; 112 } 113 114 public static void main( String [] args ) 115 { 116 String [] name = { THIS_CLASS.getName() }; 117 118 121 junit.textui.TestRunner.main( name ); 122 } 123 124 125 129 protected void setUp() throws Exception 130 { 131 super.setUp(); 132 133 134 } 136 137 138 142 protected void tearDown() throws Exception 143 { 144 146 147 super.tearDown(); 148 } 149 } 150 151 | Popular Tags |