tom.platform
Class TestHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by tom.platform.TestHandler

public class TestHandler
extends Handler


Constructor Summary
TestHandler(String fileName)
          Constructor
 
Method Summary
 void clear()
           
 void close()
           
 void flush()
           
 boolean hasError()
           
 boolean hasLog(Level level)
           
 boolean hasWarning()
           
 boolean isLoggable(LogRecord record)
          This Handler keeps track of all LogRecords, therefore this method always returns true.
 int nbOfErrors()
           
 int nbOfLogs(Level level)
           
 int nbOfWarnings()
           
 void nonRegressionTest(PlatformLogRecord record)
          This method tests if this current record was attempted by the test file by comparing the content of the message, the line, the filepath and paramaters.
 void publish(LogRecord record)
           
 String toString()
           
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestHandler

public TestHandler(String fileName)
Constructor

Method Detail

hasLog

public boolean hasLog(Level level)

hasError

public boolean hasError()

hasWarning

public boolean hasWarning()

nbOfLogs

public int nbOfLogs(Level level)

nbOfErrors

public int nbOfErrors()

nbOfWarnings

public int nbOfWarnings()

publish

public void publish(LogRecord record)
Specified by:
publish in class Handler

close

public void close()
Specified by:
close in class Handler

flush

public void flush()
Specified by:
flush in class Handler

clear

public void clear()

toString

public String toString()
Overrides:
toString in class Object

isLoggable

public boolean isLoggable(LogRecord record)
This Handler keeps track of all LogRecords, therefore this method always returns true. Please note that since we receive the LogRecords from a Logger, we actually only keep track of logs with a Level equal or higher than the Logger's.

Overrides:
isLoggable in class Handler
Parameters:
record - a given LogRecord
Returns:
true

nonRegressionTest

public void nonRegressionTest(PlatformLogRecord record)
This method tests if this current record was attempted by the test file by comparing the content of the message, the line, the filepath and paramaters. Currently, only the type of message is tested. It is insufficient because most of the messages are encapsulated in a message of type DetailedMessage

Parameters:
record - a given LogRecord