1 26 27 package net.sourceforge.groboutils.pmti.v1.autodoc.v1.server; 28 29 import net.sourceforge.groboutils.pmti.v1.autodoc.v1.*; 30 import net.sourceforge.groboutils.autodoc.v1.testserver.*; 31 32 import org.easymock.EasyMock; 33 import org.easymock.MockControl; 34 import junit.framework.Test; 35 import junit.framework.TestCase; 36 import junit.framework.TestSuite; 37 import net.sourceforge.groboutils.autodoc.v1.*; 38 import net.sourceforge.groboutils.junit.v1.iftc.*; 39 import junit.framework.AssertionFailedError; 40 import java.io.*; 41 42 43 50 public class LogFileServerUTest extends TestCase 51 { 52 55 private static final Class THIS_CLASS = LogFileServerUTest.class; 56 private static final AutoDoc DOC = new AutoDoc( THIS_CLASS ); 57 58 public LogFileServerUTest( String name ) 59 { 60 super( name ); 61 } 62 63 64 67 71 protected void setUp() throws Exception 72 { 73 super.setUp(); 74 75 } 77 78 79 82 83 public void testWriteTestData1() throws Exception 84 { 85 StringWriter sw = new StringWriter(); 86 File f = new File( "logtest-"+System.currentTimeMillis()+".tmp" ); 87 try 88 { 89 TestInfo ti = new DefaultTestInfo( "a", "b" ); 90 ITFTestData td = new ITFTestData( ti ); 91 LogFileServer lfs = new LogFileServer( f ); 92 lfs.writeTestData( td, sw ); 93 } 94 finally 95 { 96 f.delete(); 97 } 98 99 String output = sw.toString(); 100 DOC.getLog().debug(new String [] { "Log Server output='",output,"'" }); 101 assertTrue( 102 "Does not contain test suite and test name.", 103 output.indexOf( "a#b" ) >= 0 ); 104 } 105 106 107 108 111 112 115 116 public static Test suite() 117 { 118 InterfaceTestSuite suite = AbstractAppendFileServerUTestI.suite(); 119 suite.addTestSuite( THIS_CLASS ); 120 suite.addFactory( new CxFactory( "A" ) { 121 public Object createImplObject() { 122 File f = new File( "testlog-"+System.currentTimeMillis()+ 123 ".log" ); 124 return new LogFileServer( f ); 125 } 126 } ); 127 128 return suite; 129 } 130 131 public static void main( String [] args ) 132 { 133 String [] name = { THIS_CLASS.getName() }; 134 135 138 junit.textui.TestRunner.main( name ); 139 } 140 141 142 146 protected void tearDown() throws Exception 147 { 148 150 151 super.tearDown(); 152 } 153 } 154 155 | Popular Tags |