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.Handler
Abstract JUnitLogger
functionality.- 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 aLogRecord
at anyLevel
by 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 aLogRecord
at particularLevel
by anyLogger
.void
clear()
Clears the logs.void
close()
void
flush()
void
publish(java.util.logging.LogRecord record)
protected void
setupLogCapture()
Sets up the log capture.protected void
teardownLogCapture()
Tears down the log capture.
-
-
-
Method Detail
-
assertLog
public java.util.logging.LogRecord[] assertLog(java.lang.String message)
Asserts aLogRecord
at anyLevel
by anyLogger
.- Parameters:
message
- Message forLogger
.- Returns:
- Matching
LogRecord
instances.
-
assertLog
public java.util.logging.LogRecord[] assertLog(java.util.logging.Level level, java.lang.String message)
Asserts aLogRecord
at particularLevel
by anyLogger
.- Parameters:
level
- ExpectedLevel
.message
- Expected message.- Returns:
- Matching
LogRecord
instances.
-
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
LogRecord
instances.
-
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:
publish
in classjava.util.logging.Handler
-
flush
public void flush()
- Specified by:
flush
in classjava.util.logging.Handler
-
close
public void close() throws java.lang.SecurityException
- Specified by:
close
in classjava.util.logging.Handler
- Throws:
java.lang.SecurityException
-
-