Package net.officefloor.frame.test
Class LogTestSupport
java.lang.Object
net.officefloor.frame.test.LogTestSupport
- All Implemented Interfaces:
TestSupport,org.junit.jupiter.api.extension.AfterAllCallback,org.junit.jupiter.api.extension.BeforeAllCallback,org.junit.jupiter.api.extension.Extension
public class LogTestSupport
extends Object
implements TestSupport, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback
Test support for logging.
- Author:
- Daniel Sagenschneider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceLogTestSupport.TestCapture<T extends Throwable>Test capture interface. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterAll()AfterAllCallbacklogic.voidafterAll(org.junit.jupiter.api.extension.ExtensionContext context) voidBeforeAllCallbacklogic.voidbeforeAll(org.junit.jupiter.api.extension.ExtensionContext context) CaptureLoggeroutput of test logic.Capturestd out/errof test logic.voiddisplayGraph(Object root) Displays the graph of objects starting at root.voiddisplayGraph(Object root, String... ignoreMethodNames) Displays the graph of objects starting at root ignoring following verticies by the input method names.getDisplayRunTime(long startTime) Obtains run time in human readable form.getDisplayRunTime(long startTime, long endTime) Obtains run time in human readable form.voidinit(org.junit.jupiter.api.extension.ExtensionContext context) Intialise.protected booleanDetermines if printing messages.voidPrints heap memory details.voidprintMessage(InputStream message) Prints a message regarding the test.voidprintMessage(Reader message) Prints a message regarding the test.voidprintMessage(String message) Prints a message regarding the test.voidSpecifies to provide debug verbose output to aid in debugging.voidsetLogGC()Turns on logging of GC as part of test.voidsetVerbose(boolean isVerbose) Specifies to provide verbose output to aid in debugging.
-
Constructor Details
-
LogTestSupport
public LogTestSupport()Default instantiate for use asExtensionContext.
-
-
Method Details
-
init
Description copied from interface:TestSupportIntialise.- Specified by:
initin interfaceTestSupport- Parameters:
context-ExtensionContext.- Throws:
Exception- If fails to init.
-
setVerbose
public void setVerbose(boolean isVerbose) Specifies to provide verbose output to aid in debugging.- Parameters:
isVerbose-trueto turn on verbose output.
-
setDebugVerbose
public void setDebugVerbose()Specifies to provide debug verbose output to aid in debugging. -
setLogGC
public void setLogGC()Turns on logging of GC as part of test. -
captureStdOutErr
Capturestd out/errof test logic. -
captureLoggerOutput
public <T extends Throwable> String captureLoggerOutput(LogTestSupport.TestCapture<T> test) throws T CaptureLoggeroutput of test logic. -
isPrintMessages
protected boolean isPrintMessages()Determines if printing messages.- Returns:
trueto print messages.
-
printHeapMemoryDiagnostics
public void printHeapMemoryDiagnostics()Prints heap memory details. -
getDisplayRunTime
Obtains run time in human readable form.- Parameters:
startTime- Start time of running.- Returns:
- Run time in human readable form.
-
getDisplayRunTime
Obtains run time in human readable form.- Parameters:
startTime- Start time of running.endTime- End time of running.- Returns:
- Run time in human readable form.
-
printMessage
Prints a message regarding the test.- Parameters:
message- Message to be printed.
-
printMessage
Prints a message regarding the test.- Parameters:
message- Message to be printed.- Throws:
IOException- If fails to print message.
-
printMessage
Prints a message regarding the test.- Parameters:
message- Message to be printed.- Throws:
IOException- If fails to print message.
-
displayGraph
Displays the graph of objects starting at root.- Parameters:
root- Root of graph to display.- Throws:
Exception- If fails.
-
displayGraph
Displays the graph of objects starting at root ignoring following verticies by the input method names.- Parameters:
root- Root of graph to display.ignoreMethodNames- Method names to ignore.- Throws:
Exception- If fails.
-
beforeAll
- Specified by:
beforeAllin interfaceorg.junit.jupiter.api.extension.BeforeAllCallback- Throws:
Exception
-
beforeAll
BeforeAllCallbacklogic.- Throws:
Exception- If fails.
-
afterAll
- Specified by:
afterAllin interfaceorg.junit.jupiter.api.extension.AfterAllCallback- Throws:
Exception
-
afterAll
AfterAllCallbacklogic.- Throws:
Exception- If fails.
-