net.sf.logdistiller
Class LogEventTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by net.sf.logdistiller.LogEventTestCase
All Implemented Interfaces:
Test

public class LogEventTestCase
extends TestCase

Base class to write custom LogEvent junit tests more easily.

Since:
1.0

Field Summary
protected  LogType.Description description
           
protected  LogEvent.Factory factory
           
protected  LogType logtype
           
 
Constructor Summary
protected LogEventTestCase(String logtype)
           
 
Method Summary
 void checkDump(LogEvent.Factory factory, BufferedReader reader)
           
 void checkDump(LogEvent.Factory factory, String name)
           
static int dump(LogEvent.Factory factory, File file)
          Dump every LogEvent found in the factory to the given File using platform encoding.
static int dump(LogEvent.Factory factory, PrintWriter out)
          Dump every LogEvent found in the factory to the given PrintWriter.
protected  URL getResource(String name)
          get a resource from the current testcase class and check it has been found
protected  LogEvent.Factory newFactory(String name)
          create a factory for a resource (read with platform encoding).
static String readDump(BufferedReader reader)
          Read the next LogEvent dump.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logtype

protected final LogType logtype

description

protected LogType.Description description

factory

protected LogEvent.Factory factory
Constructor Detail

LogEventTestCase

protected LogEventTestCase(String logtype)
Method Detail

getResource

protected URL getResource(String name)
get a resource from the current testcase class and check it has been found

Parameters:
name - the resource to get
Returns:
the corresponding resource, not null
Throws:
RuntimeException - if resource not found
See Also:
Class.getResource(String)

newFactory

protected LogEvent.Factory newFactory(String name)
                               throws IOException
create a factory for a resource (read with platform encoding).

Throws:
IOException

dump

public static int dump(LogEvent.Factory factory,
                       PrintWriter out)
                throws IOException,
                       ParseException
Dump every LogEvent found in the factory to the given PrintWriter.

Throws:
IOException
ParseException

dump

public static int dump(LogEvent.Factory factory,
                       File file)
                throws IOException,
                       ParseException
Dump every LogEvent found in the factory to the given File using platform encoding.

Throws:
IOException
ParseException

readDump

public static String readDump(BufferedReader reader)
                       throws IOException
Read the next LogEvent dump.

Throws:
IOException

checkDump

public void checkDump(LogEvent.Factory factory,
                      BufferedReader reader)
               throws IOException,
                      ParseException
Throws:
IOException
ParseException

checkDump

public void checkDump(LogEvent.Factory factory,
                      String name)
               throws IOException,
                      ParseException
Throws:
IOException
ParseException


Copyright © 2004-2009. All Rights Reserved.