Package net.officefloor.test.logger
Class AbstractLoggerJUnit
- java.lang.Object
-
- java.util.logging.Handler
-
- net.officefloor.test.logger.AbstractLoggerJUnit
-
- Direct Known Subclasses:
LoggerExtension,LoggerRule
public class AbstractLoggerJUnit extends java.util.logging.HandlerAbstract JUnitLoggerfunctionality.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description AbstractLoggerJUnit()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.logging.LogRecord[]assertLog(java.lang.String message)Asserts aLogRecordat anyLevelby anyLogger.java.util.logging.LogRecord[]assertLog(java.lang.String loggerName, java.util.logging.Level level, java.lang.String message)Asserts a specificLogRecord.java.util.logging.LogRecord[]assertLog(java.util.logging.Level level, java.lang.String message)Asserts aLogRecordat particularLevelby anyLogger.voidclear()Clears the logs.voidclose()voidflush()voidpublish(java.util.logging.LogRecord record)protected voidsetupLogCapture()Sets up the log capture.protected voidteardownLogCapture()Tears down the log capture.
-
-
-
Method Detail
-
assertLog
public java.util.logging.LogRecord[] assertLog(java.lang.String message)
Asserts aLogRecordat anyLevelby anyLogger.- Parameters:
message- Message forLogger.- Returns:
- Matching
LogRecordinstances.
-
assertLog
public java.util.logging.LogRecord[] assertLog(java.util.logging.Level level, java.lang.String message)Asserts aLogRecordat particularLevelby anyLogger.- Parameters:
level- ExpectedLevel.message- Expected message.- Returns:
- Matching
LogRecordinstances.
-
assertLog
public java.util.logging.LogRecord[] assertLog(java.lang.String loggerName, java.util.logging.Level level, java.lang.String message)Asserts a specificLogRecord.- Parameters:
loggerName- Name ofLogger.level- ExpectedLevel.message- Expected message.- Returns:
- Matching
LogRecordinstances.
-
clear
public void clear()
Clears the logs.
-
setupLogCapture
protected void setupLogCapture()
Sets up the log capture.
-
teardownLogCapture
protected void teardownLogCapture()
Tears down the log capture.
-
publish
public void publish(java.util.logging.LogRecord record)
- Specified by:
publishin classjava.util.logging.Handler
-
flush
public void flush()
- Specified by:
flushin classjava.util.logging.Handler
-
close
public void close() throws java.lang.SecurityException- Specified by:
closein classjava.util.logging.Handler- Throws:
java.lang.SecurityException
-
-